Commit 475d6019 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

lib: retain/release the instance more consistently

All objects with a pointer back to the instance ought to retain a
reference to it (which currently means pretty much all objects).
parent 6a8352db
......@@ -375,6 +375,7 @@ libvlc_media_t * libvlc_media_new_from_input_item(
install_input_item_observer( p_md );
libvlc_retain( p_instance );
return p_md;
}
......@@ -532,7 +533,7 @@ void libvlc_media_release( libvlc_media_t *p_md )
libvlc_event_send( p_md->p_event_manager, &event );
libvlc_event_manager_release( p_md->p_event_manager );
libvlc_release( p_md->p_libvlc_instance );
free( p_md );
}
......
......@@ -254,6 +254,7 @@ libvlc_media_discoverer_new( libvlc_instance_t * p_inst, const char * psz_name )
services_discovery_removeall,
p_mdis );
libvlc_retain( p_inst );
return p_mdis;
}
......@@ -347,6 +348,7 @@ libvlc_media_discoverer_release( libvlc_media_discoverer_t * p_mdis )
vlc_dictionary_clear( &p_mdis->catname_to_submedialist, NULL, NULL );
libvlc_event_manager_release( p_mdis->p_event_manager );
libvlc_release( p_mdis->p_libvlc_instance );
free( p_mdis );
}
......
......@@ -80,6 +80,7 @@ libvlc_media_library_new( libvlc_instance_t * p_inst )
return NULL;
}
libvlc_retain( p_inst );
return p_mlib;
}
......@@ -94,6 +95,7 @@ void libvlc_media_library_release( libvlc_media_library_t * p_mlib )
return;
libvlc_event_manager_release( p_mlib->p_event_manager );
libvlc_release( p_mlib->p_libvlc_instance );
free( p_mlib );
}
......
......@@ -189,6 +189,7 @@ libvlc_media_list_new( libvlc_instance_t * p_inst )
p_mlist->p_md = NULL;
p_mlist->p_internal_md = NULL;
libvlc_retain( p_inst );
return p_mlist;
}
......@@ -227,6 +228,7 @@ void libvlc_media_list_release( libvlc_media_list_t * p_mlist )
vlc_mutex_destroy( &p_mlist->refcount_lock );
vlc_array_clear( &p_mlist->items );
libvlc_release( p_mlist->p_libvlc_instance );
free( p_mlist );
}
......
......@@ -117,6 +117,7 @@ static void libvlc_vlm_release_internal( libvlc_instance_t *p_instance )
p_instance->libvlc_vlm.p_event_manager = NULL;
vlm_Delete( p_vlm );
p_instance->libvlc_vlm.p_vlm = NULL;
libvlc_release( p_instance );
}
static int libvlc_vlm_init( libvlc_instance_t *p_instance )
......@@ -174,6 +175,7 @@ static int libvlc_vlm_init( libvlc_instance_t *p_instance )
"intf-event", VlmEvent,
p_instance->libvlc_vlm.p_event_manager );
p_instance->libvlc_vlm.pf_release = libvlc_vlm_release_internal;
libvlc_retain( p_instance );
}
return VLC_SUCCESS;
......
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