]> git.sesse.net Git - vlc/blobdiff - src/misc/media_library.c
Use var_Inherit* instead of var_CreateGet*.
[vlc] / src / misc / media_library.c
index 540b7b3fc74a29ded4e6f26d9dd19cb47802cb08..922b4935f2c5480684beaaad982a375cee7207b2 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <assert.h>
 #include <vlc_media_library.h>
+#include <vlc_modules.h>
 #include "../libvlc.h"
 
 /**
@@ -78,7 +79,7 @@ static void *ml_gc_init (ml_gc_object_t *p_gc, void (*pf_destruct) (ml_gc_object
  */
 media_library_t *ml_Create( vlc_object_t *p_this, char *psz_name )
 {
-    media_library_t *p_ml = NULL;
+    media_library_t *p_ml;
 
     p_ml = ( media_library_t * ) vlc_custom_create(
                                 p_this, sizeof( media_library_t ),
@@ -110,7 +111,8 @@ media_library_t *ml_Create( vlc_object_t *p_this, char *psz_name )
  */
 media_library_t* ml_Hold( vlc_object_t* p_this )
 {
-    media_library_t* p_ml = NULL;
+    media_library_t* p_ml;
+    vlc_mutex_lock( &( libvlc_priv( p_this->p_libvlc )->ml_lock ) );
     p_ml = libvlc_priv (p_this->p_libvlc)->p_ml;
     assert( VLC_OBJECT( p_ml ) != p_this );
     if( p_ml == NULL &&
@@ -122,6 +124,7 @@ media_library_t* ml_Hold( vlc_object_t* p_this )
     }
     if( p_ml )
         vlc_object_hold( p_ml );
+    vlc_mutex_unlock( &( libvlc_priv( p_this->p_libvlc )->ml_lock ) );
     return p_ml;
 }
 
@@ -191,7 +194,7 @@ int ml_UpdateSimple( media_library_t *p_media_library,
                                      const char* psz_lvalue,
                                      int id, ... )
 {
-    ml_element_t *update = NULL;
+    ml_element_t *update;
     vlc_array_t *array = vlc_array_new();
     int i_ret = VLC_SUCCESS;