]> git.lyx.org Git - lyx.git/blobdiff - src/sgml.cpp
PDF-form.lyx: add a note
[lyx.git] / src / sgml.cpp
index 3153ce37200113934c4eaafa5fe9c405d64fc0b3..b193593fab7b1ac6753b3cd71c3f8b2affb5174b 100644 (file)
@@ -28,6 +28,7 @@
 #include "support/textutils.h"
 
 #include <map>
+#include <QThreadStorage>
 
 using namespace std;
 using namespace lyx::support;
@@ -102,7 +103,7 @@ docstring sgml::escapeString(docstring const & raw)
 }
 
 
-docstring const sgml::uniqueID(docstring const label)
+docstring const sgml::uniqueID(docstring const label)
 {
        // FIXME THREAD
        // It seems unlikely there could be a problem here,
@@ -135,10 +136,12 @@ 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 QThreadStorage<MangledMap> tMangledNames;
+       static QThreadStorage<int> tMangleID;
+
+       MangledMap & mangledNames = tMangledNames.localData();
+       int & mangleID = tMangleID.localData();
 
        MangledMap::const_iterator const known = mangledNames.find(orig);
        if (known != mangledNames.end())