]> git.lyx.org Git - features.git/commitdiff
Make newUnnamedFile() threadsafe
authorGeorg Baum <baum@lyx.org>
Sat, 5 Jul 2014 10:58:22 +0000 (12:58 +0200)
committerGeorg Baum <baum@lyx.org>
Sat, 5 Jul 2014 10:58:22 +0000 (12:58 +0200)
src/buffer_funcs.cpp

index 3f64b909f2ce827b9b0262131f1c430fe9ac4417..03ecc90abeb9d9a8bea5c4ec654ac38fde923016 100644 (file)
@@ -47,6 +47,7 @@
 #include "support/filetools.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
+#include "support/mutex.h"
 #include "support/textutils.h"
 
 using namespace std;
@@ -172,9 +173,10 @@ Buffer * newFile(string const & filename, string const & templatename,
 Buffer * newUnnamedFile(FileName const & path, string const & prefix,
                                                string const & templatename)
 {
-       // FIXME THREAD
        static map<string, int> file_number;
+       static Mutex mutex;
 
+       Mutex::Locker locker(&mutex);
        FileName filename;
 
        do {