mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-14 23:12:31 +00:00
Make DocFileName::mangledFileName() threadsafe
This commit is contained in:
parent
7f1fa090e3
commit
211e1661b5
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user