]> git.sesse.net Git - vlc/blobdiff - src/interface/interaction.c
Clean up coments.
[vlc] / src / interface / interaction.c
index f58d757eb798b9e8762b7d46847ef298fe7887ab..2359516378e20d7fff93710105779f8c170d6365 100644 (file)
@@ -343,7 +343,10 @@ void __intf_UserHide( vlc_object_t *p_this, int i_id )
     p_dialog = DialogGetById( p_interaction, i_id );
 
     if( p_dialog )
+    {
         p_dialog->i_status = ANSWERED_DIALOG;
+        vlc_object_signal_unlocked( p_interaction );
+    }
 
     vlc_object_unlock( p_interaction );
     vlc_object_release( p_interaction );
@@ -407,7 +410,7 @@ static interaction_t * InteractionGet( vlc_object_t *p_this )
 {
     interaction_t *obj = libvlc_priv(p_this->p_libvlc)->p_interaction;
     if( obj )
-        vlc_object_yield( obj );
+        vlc_object_hold( obj );
     return obj;
 }
 
@@ -470,9 +473,14 @@ static int DialogSend( vlc_object_t *p_this, interaction_dialog_t *p_dialog )
 {
     interaction_t *p_interaction = InteractionGet( p_this );
 
+    if( !p_interaction )
+        return VLC_EGENERIC;
+
     /* Get an id, if we don't already have one */
+    vlc_object_lock( p_interaction );
     if( p_dialog->i_id == 0 )
         p_dialog->i_id = ++p_interaction->i_last_id;
+    vlc_object_unlock( p_interaction );
 
     if( p_this->i_flags & OBJECT_FLAGS_NOINTERACT )
     {
@@ -550,8 +558,8 @@ static int DialogSend( vlc_object_t *p_this, interaction_dialog_t *p_dialog )
 
 static void* InteractionLoop( vlc_object_t *p_this )
 {
-    int i;
     interaction_t *p_interaction = (interaction_t*) p_this;
+    int canc = vlc_savecancel ();
 
     vlc_object_lock( p_this );
     while( vlc_object_alive( p_this ) )
@@ -562,12 +570,13 @@ static void* InteractionLoop( vlc_object_t *p_this )
     vlc_object_unlock( p_this );
 
     /* Remove all dialogs - Interfaces must be able to clean up their data */
-    for( i = p_interaction->i_dialogs -1 ; i >= 0; i-- )
+    for( int i = p_interaction->i_dialogs -1 ; i >= 0; i-- )
     {
         interaction_dialog_t * p_dialog = p_interaction->pp_dialogs[i];
         DialogDestroy( p_dialog );
         REMOVE_ELEM( p_interaction->pp_dialogs, p_interaction->i_dialogs, i );
     }
+    vlc_restorecancel (canc);
     return NULL;
 }
 
@@ -603,7 +612,7 @@ static void InteractionManage( interaction_t *p_interaction )
         }
     }
     else
-        vlc_object_yield( p_interaction->p_intf );
+        vlc_object_hold( p_interaction->p_intf );
 
     for( i_index = 0 ; i_index < p_interaction->i_dialogs; i_index ++ )
     {