]> git.sesse.net Git - vlc/blobdiff - modules/misc/lua/extension_thread.c
lua: vlclua_playlist_add_internal() should post an input item tree
[vlc] / modules / misc / lua / extension_thread.c
index ac3a4592e45fcc387d07d7654da0c8797582c11b..cadfc3acc1fc17d633d4fac1b2f16fa2420564e1 100644 (file)
@@ -198,9 +198,7 @@ static int RemoveActivated( extensions_manager_t *p_mgr, extension_t *p_ext )
 /** Wait for an extension to finish */
 void WaitForDeactivation( extension_t *p_ext )
 {
-    void *pointer = NULL;
-    vlc_cond_signal( &p_ext->p_sys->wait );
-    vlc_join( p_ext->p_sys->thread, &pointer );
+    vlc_join( p_ext->p_sys->thread, NULL );
 }
 
 /** Push a UI command */
@@ -287,6 +285,7 @@ static void* Run( void *data )
         if( cmd )
         {
             p_ext->p_sys->command = cmd->next;
+            cmd->next = NULL; // This prevents FreeCommands from freeing next
         }
 
         vlc_mutex_unlock( &p_ext->p_sys->command_lock );
@@ -348,7 +347,6 @@ static void* Run( void *data )
                         msg_Dbg( p_mgr, "Trigger menu %d of '%s'",
                                  *pi_id, p_ext->psz_name );
                         lua_ExtensionTriggerMenu( p_mgr, p_ext, *pi_id );
-                        free( pi_id );
                         break;
                     }
 
@@ -375,6 +373,8 @@ static void* Run( void *data )
             }
         }
 
+        FreeCommands( cmd );
+
         vlc_mutex_lock( &p_ext->p_sys->command_lock );
         if( !p_ext->p_sys->b_exiting && !p_ext->p_sys->command )
         {
@@ -383,7 +383,7 @@ static void* Run( void *data )
     }
 
     vlc_mutex_unlock( &p_ext->p_sys->command_lock );
-    msg_Dbg( p_mgr, "Extension thread ending..." );
+    msg_Dbg( p_mgr, "Extension thread end: '%s'", p_ext->psz_title );
 
     // Note: At this point, the extension should be deactivated
     return NULL;