Commit 3cf52073 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

libvlc_event_detach: remove exception

parent 2c57cb80
......@@ -309,13 +309,11 @@ VLC_PUBLIC_API void libvlc_event_attach( libvlc_event_manager_t *p_event_manager
* \param i_event_type the desired event to which we want to unregister
* \param f_callback the function to call when i_event_type occurs
* \param p_user_data user provided data to carry with the event
* \param p_e an initialized exception pointer
*/
VLC_PUBLIC_API void libvlc_event_detach( libvlc_event_manager_t *p_event_manager,
libvlc_event_type_t i_event_type,
libvlc_callback_t f_callback,
void *p_user_data,
libvlc_exception_t *p_e );
void *p_user_data );
/**
* Get an event's type name.
......
......@@ -355,10 +355,8 @@ void libvlc_event_attach_async( libvlc_event_manager_t * p_event_manager,
void libvlc_event_detach( libvlc_event_manager_t *p_event_manager,
libvlc_event_type_t event_type,
libvlc_callback_t pf_callback,
void *p_user_data,
libvlc_exception_t *p_e )
void *p_user_data )
{
VLC_UNUSED( p_e );
libvlc_event_listeners_group_t * listeners_group;
libvlc_event_listener_t * listener;
int i, j;
......
......@@ -145,16 +145,16 @@ hierarch_media_list_view_release( libvlc_media_list_view_t * p_mlv )
{
libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
libvlc_MediaListItemAdded,
media_list_item_added, p_mlv, NULL );
media_list_item_added, p_mlv );
libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
libvlc_MediaListWillAddItem,
media_list_will_add_item, p_mlv, NULL );
media_list_will_add_item, p_mlv );
libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
libvlc_MediaListItemDeleted,
media_list_item_deleted, p_mlv, NULL );
media_list_item_deleted, p_mlv );
libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
libvlc_MediaListWillDeleteItem,
media_list_will_delete_item, p_mlv, NULL );
media_list_will_delete_item, p_mlv );
}
/**************************************************************************
......
......@@ -235,7 +235,7 @@ media_list_item_deleted( const libvlc_event_t * p_event, void * user_data )
if( index >= 0)
libvlc_media_list_view_item_deleted( p_mlv, p_md, index );
libvlc_event_detach( p_md->p_event_manager, libvlc_MediaSubItemAdded,
items_subitems_added, p_mlv, NULL );
items_subitems_added, p_mlv );
}
static void
media_list_will_delete_item( const libvlc_event_t * p_event, void * user_data )
......@@ -266,16 +266,16 @@ hierarch_node_media_list_view_release( libvlc_media_list_view_t * p_mlv )
trace("\n");
libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
libvlc_MediaListItemAdded,
media_list_item_added, p_mlv, NULL );
media_list_item_added, p_mlv );
libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
libvlc_MediaListWillAddItem,
media_list_will_add_item, p_mlv, NULL );
media_list_will_add_item, p_mlv );
libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
libvlc_MediaListItemDeleted,
media_list_item_deleted, p_mlv, NULL );
media_list_item_deleted, p_mlv );
libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
libvlc_MediaListWillDeleteItem,
media_list_will_delete_item, p_mlv, NULL );
media_list_will_delete_item, p_mlv );
}
/**************************************************************************
......
......@@ -369,7 +369,7 @@ uninstall_playlist_observer(libvlc_media_list_player_t * p_mlp)
{
assert_locked(p_mlp);
if (!p_mlp->p_mlist) return;
libvlc_event_detach(mlist_em(p_mlp), libvlc_MediaListItemDeleted, mlist_item_deleted, p_mlp, NULL);
libvlc_event_detach(mlist_em(p_mlp), libvlc_MediaListItemDeleted, mlist_item_deleted, p_mlp);
}
/**************************************************************************
......@@ -398,7 +398,7 @@ uninstall_media_player_observer(libvlc_media_list_player_t * p_mlp)
// Allow callbacks to run, because detach() will wait until all callbacks are processed.
// This is safe because only callbacks are allowed, and there execution will be cancelled.
vlc_mutex_unlock(&p_mlp->mp_callback_lock);
libvlc_event_detach(mplayer_em(p_mlp), libvlc_MediaPlayerEndReached, media_player_reached_end, p_mlp, NULL);
libvlc_event_detach(mplayer_em(p_mlp), libvlc_MediaPlayerEndReached, media_player_reached_end, p_mlp);
// Now, lock back the callback lock. No more callback will be present from this point.
vlc_mutex_lock(&p_mlp->mp_callback_lock);
......
......@@ -103,22 +103,18 @@ uninstall_md_listener( libvlc_media_list_view_t * p_mlv,
libvlc_media_t * p_md)
{
libvlc_media_list_t * p_mlist;
libvlc_exception_t ignored_exception;
libvlc_exception_init( &ignored_exception );
libvlc_event_detach( p_md->p_event_manager,
libvlc_MediaSubItemAdded,
media_list_subitem_added, p_mlv, &ignored_exception );
if( libvlc_exception_raised( &ignored_exception ) )
libvlc_exception_clear( &ignored_exception ); /* We don't care if we encounter an exception */
media_list_subitem_added, p_mlv );
if((p_mlist = libvlc_media_subitems( p_md )))
{
libvlc_media_list_lock( p_mlist );
libvlc_event_detach( p_mlist->p_event_manager,
libvlc_MediaListItemAdded,
media_list_item_added, p_mlv, NULL );
media_list_item_added, p_mlv );
libvlc_event_detach( p_mlist->p_event_manager,
libvlc_MediaListItemDeleted,
media_list_item_removed, p_mlv, NULL );
media_list_item_removed, p_mlv );
int i, count = libvlc_media_list_count( p_mlist, NULL );
for( i = 0; i < count; i++)
......@@ -166,7 +162,7 @@ media_list_subitem_added( const libvlc_event_t * p_event, void * p_user_data )
* thus, no need to wait for SubItemAdded events */
libvlc_event_detach( p_md->p_event_manager,
libvlc_MediaSubItemAdded,
media_list_subitem_added, p_mlv, NULL );
media_list_subitem_added, p_mlv );
libvlc_media_list_lock( p_mlist );
libvlc_event_attach( p_mlist->p_event_manager,
......@@ -383,13 +379,13 @@ libvlc_media_list_view_release( libvlc_media_list_view_t * p_mlv )
{
libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
libvlc_MediaListItemAdded,
media_list_item_added, p_mlv, NULL );
media_list_item_added, p_mlv );
}
if( p_mlv->pf_ml_item_removed )
{
libvlc_event_detach( p_mlv->p_mlist->p_event_manager,
libvlc_MediaListItemDeleted,
media_list_item_removed, p_mlv, NULL );
media_list_item_removed, p_mlv );
}
int i, count = libvlc_media_list_count( p_mlv->p_mlist, NULL );
for( i = 0; i < count; i++)
......
......@@ -42,7 +42,7 @@ static void test_events_callback_and_detach( const libvlc_event_t * event, void
em = libvlc_media_player_event_manager (event->p_obj);
libvlc_event_detach (em, event->type, test_events_callback_and_detach, user_data, &ex);
libvlc_event_detach (em, event->type, test_events_callback_and_detach, user_data);
*callback_was_called = true;
}
......@@ -101,8 +101,7 @@ static void test_events (const char ** argv, int argc)
event.type = mi_events[mi_events_len-1];
callback_was_called = false;
libvlc_event_detach (em, mi_events[mi_events_len-1], test_events_dummy_callback, &callback_was_called, &ex);
catch ();
libvlc_event_detach (em, mi_events[mi_events_len-1], test_events_dummy_callback, &callback_was_called);
libvlc_event_attach (em, mi_events[mi_events_len-1], test_events_callback_and_detach, &callback_was_called, &ex);
catch ();
......@@ -116,10 +115,8 @@ static void test_events (const char ** argv, int argc)
log ("+ Testing regular detach()\n");
for (i = 0; i < mi_events_len - 1; i++) {
libvlc_event_detach (em, mi_events[i], test_events_dummy_callback, &callback_was_called, &ex);
catch ();
}
for (i = 0; i < mi_events_len - 1; i++)
libvlc_event_detach (em, mi_events[i], test_events_dummy_callback, &callback_was_called);
libvlc_media_player_release (mi);
catch ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment