From: Georg Baum Date: Mon, 7 Jul 2014 20:01:58 +0000 (+0200) Subject: Make DocFileName::mangledFileName() threadsafe X-Git-Tag: 2.1.2~51 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=211e1661b546ff4a0c38fd385661156d1b0be331;p=features.git Make DocFileName::mangledFileName() threadsafe --- diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index f0489309d5..a063bdc122 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -17,6 +17,7 @@ #include "support/filetools.h" #include "support/lassert.h" #include "support/lstrings.h" +#include "support/mutex.h" #include "support/qstring_helpers.h" #include "support/os.h" #include "support/Package.h" @@ -929,6 +930,9 @@ string DocFileName::mangledFileName(string const & dir) const // filename returns the same mangled name. typedef map MangledMap; static MangledMap mangledNames; + static Mutex mangledMutex; + // this locks both access to mangledNames and counter below + Mutex::Locker lock(&mangledMutex); MangledMap::const_iterator const it = mangledNames.find(absFileName()); if (it != mangledNames.end()) return (*it).second;