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 \
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 );
{
interaction_t *obj = libvlc_priv(p_this->p_libvlc)->p_interaction;
if( obj )
- vlc_object_yield( obj );
+ vlc_object_hold( obj );
return obj;
}
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 ) )
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;
}
}
}
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 ++ )
{