X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsgml.cpp;h=75802c2bd44d2113da87253c0c31ffb0fc267df0;hb=5471139ecb19923cd3410bf7f520766148daa1aa;hp=4842b07912e8f2f4524782a12093a5b3865174b8;hpb=2be29006adc748e343ad17126e0e62ef75b16afc;p=lyx.git diff --git a/src/sgml.cpp b/src/sgml.cpp index 4842b07912..75802c2bd4 100644 --- a/src/sgml.cpp +++ b/src/sgml.cpp @@ -28,6 +28,7 @@ #include "support/textutils.h" #include +#include using namespace std; using namespace lyx::support; @@ -102,8 +103,11 @@ 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, + // but we could have concurrent access, in principle. static unsigned int seed = 1000; return label + convert(++seed); } @@ -133,8 +137,10 @@ docstring sgml::cleanID(Buffer const & buf, OutputParams const & runparams, docstring content; typedef map MangledMap; - static MangledMap mangledNames; - static int mangleID = 1; + static QThreadStorage tMangledNames; + static QThreadStorage tMangleID; + + MangledMap & mangledNames = tMangledNames.localData(); MangledMap::const_iterator const known = mangledNames.find(orig); if (known != mangledNames.end()) @@ -163,9 +169,10 @@ docstring sgml::cleanID(Buffer const & buf, OutputParams const & runparams, } } - if (mangle) + if (mangle) { + int & mangleID = tMangleID.localData(); content += "-" + convert(mangleID++); - else if (isDigitASCII(content[content.size() - 1])) + } else if (isDigitASCII(content[content.size() - 1])) content += "."; mangledNames[orig] = content;