From 9dae9a9d4f7f283ac0f5f34a0b1cd7d264bca41f Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Mon, 7 Jul 2014 21:38:39 +0200 Subject: [PATCH] Make newUnnamedFile() threadsafe --- src/buffer_funcs.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/buffer_funcs.cpp b/src/buffer_funcs.cpp index 26bff558f6..03ecc90abe 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 file_number; + static Mutex mutex; + Mutex::Locker locker(&mutex); FileName filename; do { -- 2.39.5