]> git.sesse.net Git - vlc/commitdiff
Lua: extension: fix inverted cancellation logic
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 16 Jun 2013 14:21:23 +0000 (17:21 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 16 Jun 2013 14:22:38 +0000 (17:22 +0300)
The cancellation-safe section was protected instead of the
cancellation-unsafe section.

modules/lua/extension_thread.c

index 2b5fe5a80127eab1fcbeb903fcb199be908c49fa..926fa821c122de065b8ef2f32dbf3789fc94467c 100644 (file)
@@ -320,8 +320,8 @@ static void* Run( void *data )
     extension_t *p_ext = data;
     extensions_manager_t *p_mgr = p_ext->p_sys->p_mgr;
 
-    int cancel = vlc_savecancel();
     vlc_mutex_lock( &p_ext->p_sys->command_lock );
+    mutex_cleanup_push( &p_ext->p_sys->command_lock );
 
     while( !p_ext->p_sys->b_exiting )
     {
@@ -337,12 +337,11 @@ static void* Run( void *data )
         cmd->next = NULL; /* unlink command (for FreeCommands()) */
 
         vlc_mutex_unlock( &p_ext->p_sys->command_lock );
-        vlc_restorecancel( cancel );
 
         /* Run command */
+        int cancel = vlc_savecancel();
         if( LockExtension( p_ext ) )
         {
-            mutex_cleanup_push( &p_ext->p_sys->running_lock );
             switch( cmd->i_command )
             {
                 case CMD_ACTIVATE:
@@ -424,18 +423,16 @@ static void* Run( void *data )
                     break;
                 }
             }
-            vlc_cleanup_pop();
             UnlockExtension( p_ext );
         }
         FreeCommands( cmd );
 
-        cancel = vlc_savecancel();
+        vlc_restorecancel( cancel );
         vlc_mutex_lock( &p_ext->p_sys->command_lock );
     }
 
-    vlc_mutex_unlock( &p_ext->p_sys->command_lock );
+    vlc_cleanup_run( );
     msg_Dbg( p_mgr, "Extension thread end: '%s'", p_ext->psz_title );
-    vlc_restorecancel( cancel );
 
     // Note: At this point, the extension should be deactivated
     return NULL;