[vlc-commits] lib: retain/release the instance more consistently
Rémi Denis-Courmont
git at videolan.org
Wed Aug 5 18:10:44 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jul 30 23:37:37 2015 +0300| [475d6019b3662054eae4d8d9737cf217aa55617e] | committer: 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).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=475d6019b3662054eae4d8d9737cf217aa55617e
---
lib/media.c | 3 ++-
lib/media_discoverer.c | 2 ++
lib/media_library.c | 2 ++
lib/media_list.c | 2 ++
lib/vlm.c | 2 ++
5 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/media.c b/lib/media.c
index f5886ad..d76a3ab 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -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 );
}
diff --git a/lib/media_discoverer.c b/lib/media_discoverer.c
index 4e11c80..1e9d163 100644
--- a/lib/media_discoverer.c
+++ b/lib/media_discoverer.c
@@ -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 );
}
diff --git a/lib/media_library.c b/lib/media_library.c
index 9edc5f7..4bb07d5 100644
--- a/lib/media_library.c
+++ b/lib/media_library.c
@@ -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 );
}
diff --git a/lib/media_list.c b/lib/media_list.c
index d4dae1a..263b388 100644
--- a/lib/media_list.c
+++ b/lib/media_list.c
@@ -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 );
}
diff --git a/lib/vlm.c b/lib/vlm.c
index 4f808c8..735222d 100644
--- a/lib/vlm.c
+++ b/lib/vlm.c
@@ -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;
More information about the vlc-commits
mailing list