]> git.sesse.net Git - vlc/commitdiff
taglib is not thread-safe
authorRafaël Carré <rafael.carre@gmail.com>
Sun, 24 Oct 2010 16:14:33 +0000 (18:14 +0200)
committerRafaël Carré <rafael.carre@gmail.com>
Sun, 24 Oct 2010 16:16:40 +0000 (18:16 +0200)
Fix ticket #3958

modules/meta_engine/taglib.cpp

index 33866d0b644bd7b6094d84ac635d9aa8b362411b..f67dbdafd8e9ec8d44de088862b2a13f1891efbb 100644 (file)
@@ -77,6 +77,8 @@
 #include <textidentificationframe.h>
 #include <uniquefileidentifierframe.h>
 
+// taglib is not thread safe
+static vlc_mutex_t taglib_lock = VLC_STATIC_MUTEX;
 
 // Local functions
 static int ReadMeta    ( vlc_object_t * );
@@ -363,6 +365,7 @@ static void ReadMetaFromMP4( MP4::Tag* tag, demux_t *p_demux, demux_meta_t *p_de
  */
 static int ReadMeta( vlc_object_t* p_this)
 {
+    vlc_mutex_locker locker (&taglib_lock);
     demux_meta_t*   p_demux_meta = (demux_meta_t *)p_this;
     demux_t*        p_demux = p_demux_meta->p_demux;
     vlc_meta_t*     p_meta;
@@ -585,6 +588,7 @@ static void WriteMetaToXiph( Ogg::XiphComment* tag, input_item_t* p_item )
 
 static int WriteMeta( vlc_object_t *p_this )
 {
+    vlc_mutex_locker locker (&taglib_lock);
     meta_export_t *p_export = (meta_export_t *)p_this;
     input_item_t *p_item = p_export->p_item;
     FileRef f;