X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsgml.cpp;h=2facb3ed539e280d459fed50a9f9fba1ba7f3b48;hb=d7dfa275749c4dde6aac4ce55e8e3f92d9362d8a;hp=b193593fab7b1ac6753b3cd71c3f8b2affb5174b;hpb=9c55af4a223ce4db29d643251109e245665344bd;p=lyx.git diff --git a/src/sgml.cpp b/src/sgml.cpp index b193593fab..2facb3ed53 100644 --- a/src/sgml.cpp +++ b/src/sgml.cpp @@ -27,6 +27,7 @@ #include "support/lstrings.h" #include "support/textutils.h" +#include #include #include @@ -105,10 +106,8 @@ docstring sgml::escapeString(docstring const & raw) 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; + // thread-safe + static atomic_uint seed(1000); return label + convert(++seed); } @@ -141,7 +140,6 @@ docstring sgml::cleanID(Buffer const & buf, OutputParams const & runparams, static QThreadStorage tMangleID; MangledMap & mangledNames = tMangledNames.localData(); - int & mangleID = tMangleID.localData(); MangledMap::const_iterator const known = mangledNames.find(orig); if (known != mangledNames.end()) @@ -170,9 +168,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;