[vlc-devel] commit: Only allow VLC_OBJECT_MODULE outside of p_libvlc ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon May 26 21:54:58 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Mon May 26 22:53:44 2008 +0300| [c865a653ad0a4341af807a2018c8686a4a1c5bf2]

Only allow VLC_OBJECT_MODULE outside of p_libvlc

Speeds up vlc_list_find(), as we avoid looking up the 200+ plugins for
each vlc_list_find(). Also avoids accidentally stealing objects across
LibVLC instances. IMHO, the object tree should be per-instance, and the
root object should not exist, but that's too big a change yet.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c865a653ad0a4341af807a2018c8686a4a1c5bf2
---

 src/misc/objects.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/misc/objects.c b/src/misc/objects.c
index 069d385..8092c39 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -970,7 +970,13 @@ vlc_list_t * __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
     switch( i_mode & 0x000f )
     {
     case FIND_ANYWHERE:
-        return vlc_list_find (vlc_global (), i_type, FIND_CHILD);
+        /* Modules should probably not be object, and the module should perhaps
+         * not be shared across LibVLC instances. In the mean time, this ugly
+         * hack is brought to you by Courmisch. */
+        if (i_type == VLC_OBJECT_MODULE)
+            return vlc_list_find ((vlc_object_t *)vlc_global ()->p_module_bank,
+                                  i_type, FIND_CHILD);
+        return vlc_list_find (p_this->p_libvlc, i_type, FIND_CHILD);
 
     case FIND_CHILD:
         vlc_mutex_lock( &structure_lock );




More information about the vlc-devel mailing list