commit 9dae9a9d4f7f283ac0f5f34a0b1cd7d264bca41f
Author: Georg Baum <[email protected]>
Date:   Mon Jul 7 21:38:39 2014 +0200

    Make newUnnamedFile() threadsafe

diff --git a/src/buffer_funcs.cpp b/src/buffer_funcs.cpp
index 26bff55..03ecc90 100644
--- a/src/buffer_funcs.cpp
+++ b/src/buffer_funcs.cpp
@@ -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;
@@ -173,7 +174,9 @@ Buffer * newUnnamedFile(FileName const & path, string const 
& prefix,
                                                string const & templatename)
 {
        static map<string, int> file_number;
+       static Mutex mutex;
 
+       Mutex::Locker locker(&mutex);
        FileName filename;
 
        do {

Reply via email to