#include "support/textutils.h"
#include <map>
+#include <QThreadStorage>
using namespace std;
using namespace lyx::support;
}
-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,
+ // but we could have concurrent access, in principle.
static unsigned int seed = 1000;
return label + convert<docstring>(++seed);
}
docstring content;
typedef map<docstring, docstring> MangledMap;
- static MangledMap mangledNames;
- static int mangleID = 1;
+ static QThreadStorage<MangledMap> tMangledNames;
+ static QThreadStorage<int> tMangleID;
+
+ MangledMap & mangledNames = tMangledNames.localData();
MangledMap::const_iterator const known = mangledNames.find(orig);
if (known != mangledNames.end())
}
}
- if (mangle)
+ if (mangle) {
+ int & mangleID = tMangleID.localData();
content += "-" + convert<docstring>(mangleID++);
- else if (isDigitASCII(content[content.size() - 1]))
+ } else if (isDigitASCII(content[content.size() - 1]))
content += ".";
mangledNames[orig] = content;