]> git.sesse.net Git - vlc/blobdiff - modules/access/vcdx/intf.c
Add some warnings
[vlc] / modules / access / vcdx / intf.c
index 34d382b1c77224248ca12aa597b7ad551ff6c019..338f13abef928a6adfaf4154ffe729ec00e4bb85 100644 (file)
@@ -105,6 +105,7 @@ RunIntf( intf_thread_t *p_intf )
        the 10_ADD keypresses */
     int number_addend = 0;
 
+    int canc = vlc_savecancel();
     if( InitThread( p_intf ) < 0 )
     {
         msg_Err( p_intf, "can't initialize intf" );
@@ -121,10 +122,11 @@ RunIntf( intf_thread_t *p_intf )
     p_vcdplayer = p_intf->p_sys->p_vcdplayer;
     p_access    = p_vcdplayer->p_access;
 
+    canc = vlc_savecancel();
     dbg_print( INPUT_DBG_CALL, "intf initialized" );
 
     /* Main loop */
-    while( !p_intf->b_die )
+    while( vlc_object_alive (p_intf) )
     {
       vlc_mutex_lock( &p_intf->change_lock );
 
@@ -298,8 +300,8 @@ RunIntf( intf_thread_t *p_intf )
         }
 
 
-      /* Wait a bit */
-      msleep( INTF_IDLE_SLEEP );
+        /* Wait a bit */
+        msleep( INTF_IDLE_SLEEP );
     }
 
     if( p_vout )
@@ -309,6 +311,7 @@ RunIntf( intf_thread_t *p_intf )
     }
 
     vlc_object_release( p_intf->p_sys->p_input );
+    vlc_restorecancel( canc );
 }
 
 /*****************************************************************************
@@ -317,35 +320,24 @@ RunIntf( intf_thread_t *p_intf )
 static int InitThread( intf_thread_t * p_intf )
 {
     /* We might need some locking here */
-    if( !p_intf->b_die )
-    {
-        input_thread_t * p_input;
+    input_thread_t * p_input;
 
-        p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_PARENT );
+    p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_PARENT );
 
-        /* Maybe the input just died */
-        if( p_input == NULL )
-        {
-            return VLC_EGENERIC;
-        }
-
-        vlc_mutex_lock( &p_intf->change_lock );
+    /* Maybe the input just died */
+    if( p_input == NULL )
+        return VLC_EGENERIC;
 
-        p_intf->p_sys->p_input     = p_input;
-        p_intf->p_sys->p_vcdplayer = NULL;
+    vlc_mutex_lock( &p_intf->change_lock );
 
-        p_intf->p_sys->b_move  = false;
-        p_intf->p_sys->b_click = false;
-        p_intf->p_sys->b_key_pressed = false;
+    p_intf->p_sys->p_input     = p_input;
+    p_intf->p_sys->p_vcdplayer = NULL;
 
-        vlc_mutex_unlock( &p_intf->change_lock );
+    p_intf->p_sys->b_move  = false;
+    p_intf->p_sys->b_click = false;
+    p_intf->p_sys->b_key_pressed = false;
 
-        return VLC_SUCCESS;
-    }
-    else
-    {
-        return VLC_EGENERIC;
-    }
+    vlc_mutex_unlock( &p_intf->change_lock );
 }
 
 /*****************************************************************************