]> git.lyx.org Git - lyx.git/commitdiff
Make static variables used in DocBook output thread-safe.
authorRichard Heck <rgheck@lyx.org>
Sun, 26 Oct 2014 16:53:41 +0000 (12:53 -0400)
committerRichard Heck <rgheck@lyx.org>
Sun, 26 Oct 2014 17:01:48 +0000 (13:01 -0400)
src/sgml.cpp

index fdd0ed7270cf32ed4ba5b706eb0622a553837024..125ef611fa89e345b18e00f23d8fec4cb8de0e3c 100644 (file)
@@ -26,6 +26,7 @@
 #include "support/docstream.h"
 #include "support/lstrings.h"
 #include "support/textutils.h"
+#include "support/ThreadStorage.h"
 
 #include <map>
 
@@ -135,10 +136,11 @@ docstring sgml::cleanID(Buffer const & buf, OutputParams const & runparams,
 
        docstring content;
 
-       // FIXME THREAD
        typedef map<docstring, docstring> MangledMap;
-       static MangledMap mangledNames;
-       static int mangleID = 1;
+       static ThreadStorage<MangledMap> tMangledNames;
+       MangledMap & mangledNames = *tMangledNames;
+       static ThreadStorage<int> tMangleID;
+       int & mangleID = *tMangleID;
 
        MangledMap::const_iterator const known = mangledNames.find(orig);
        if (known != mangledNames.end())