]> git.sesse.net Git - vlc/blobdiff - src/interface/interaction.c
b_menu_change: remove write-only variable
[vlc] / src / interface / interaction.c
index eaca6d815b9d665f7b8f651399e3be476b8b2528..2be331760057e2edf1eb1eb920b909ad734d21a9 100644 (file)
@@ -56,13 +56,13 @@ static void                     DialogDestroy( interaction_dialog_t * );
 static int DialogSend( vlc_object_t *, interaction_dialog_t * );
 
 #define DIALOG_INIT( type ) \
-        DECMALLOC_ERR( p_new, interaction_dialog_t );       \
-        memset( p_new, 0, sizeof( interaction_dialog_t ) ); \
+        interaction_dialog_t* p_new = calloc( 1, sizeof( interaction_dialog_t ) ); \
+        if( !p_new ) return VLC_EGENERIC;               \
         p_new->b_cancelled = false;                     \
-        p_new->i_status = NEW_DIALOG;                       \
-        p_new->i_flags = 0;                                 \
-        p_new->i_type = INTERACT_DIALOG_##type;             \
-        p_new->psz_returned[0] = NULL;                      \
+        p_new->i_status = NEW_DIALOG;                   \
+        p_new->i_flags = 0;                             \
+        p_new->i_type = INTERACT_DIALOG_##type;         \
+        p_new->psz_returned[0] = NULL;                  \
         p_new->psz_returned[1] = NULL
 
 #define FORMAT_DESC \
@@ -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;
 }
 
@@ -555,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 ) )
@@ -567,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;
 }
 
@@ -608,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 ++ )
     {