commit 211e1661b546ff4a0c38fd385661156d1b0be331
Author: Georg Baum <[email protected]>
Date: Mon Jul 7 22:01:58 2014 +0200
Make DocFileName::mangledFileName() threadsafe
diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp
index f048930..a063bdc 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<string, string> 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;