[vlc-commits] commit: taglib is not thread-safe ( Rafaël Carré )

git at videolan.org git at videolan.org
Mon Oct 25 18:57:25 CEST 2010


vlc/vlc-1.1 | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Sun Oct 24 18:14:33 2010 +0200| [2764c076586db431d5ba3e25ff2afbc95e1f8313] | committer: Rafaël Carré 

taglib is not thread-safe

Fix ticket #3958
(cherry picked from commit 8675d26cea713ca9ebae3b91bd7c3e9bb320dcb1)

Signed-off-by: Rafaël Carré <rafael.carre at gmail.com>

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

 modules/meta_engine/taglib.cpp |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index 553871a..9bc3235 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -76,6 +76,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 * );
@@ -359,6 +361,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;
@@ -569,6 +572,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;



More information about the vlc-commits mailing list