commit fdbe775b9f5468e8f53dc83a66583f412b5970fb
Author: Richard Heck <rgh...@lyx.org>
Date:   Mon Oct 7 18:59:05 2013 -0400

    This is the result of an audit of all static variables, looking
    for possible thread conflicts, of the sort Georg resolved at
    6a30211f. I have made static variables const where possible,
    and marked cases that looked potentially problematic with the
    comment:
        // FIXME THREAD
    Many of these definitely are vulnerable to concurrent access, such
    as the static variables declared at the start of output_latex.cpp.
    Suppose, e.g., we were outputting latex and also displaying the
    source of a different document.
    
    I'd appreciate it if others could grep for "FIXME THREAD" and see
    if some of these are harmless, or what.

diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp
index a50a865..7c77610 100644
--- a/src/BiblioInfo.cpp
+++ b/src/BiblioInfo.cpp
@@ -472,7 +472,7 @@ docstring BibTeXInfo::expandFormat(docstring const & format,
                docstring before, docstring after, docstring dialog, bool next) 
const
 {
        // incorrect use of macros could put us in an infinite loop
-       static int max_passes = 5000;
+       static int const max_passes = 5000;
        // the use of overly large keys can lead to performance problems, due
        // to eventual attempts to convert LaTeX macros to unicode. See bug
        // #8944. This is perhaps not the best solution, but it will have to
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index ab2164b..6f7a5cd 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -354,6 +354,7 @@ private:
 /// Creates the per buffer temporary directory
 static FileName createBufferTmpDir()
 {
+       // FIXME THREAD
        static int count;
        // We are in our own directory.  Why bother to mangle name?
        // In fact I wrote this code to circumvent a problematic behaviour
diff --git a/src/BufferList.cpp b/src/BufferList.cpp
index 341ddf4..de5a7ab 100644
--- a/src/BufferList.cpp
+++ b/src/BufferList.cpp
@@ -156,6 +156,7 @@ void BufferList::closeAll()
 
 FileNameList const & BufferList::fileNames() const
 {
+       // FIXME THREAD
        static FileNameList nvec;
        nvec.clear();
        BufferStorage::const_iterator it = bstore.begin();
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 3b85ff7..a70bc9e 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -122,7 +122,8 @@ ParSepTranslator const init_parseptranslator()
 
 ParSepTranslator const & parseptranslator()
 {
-       static ParSepTranslator translator = init_parseptranslator();
+       static ParSepTranslator const translator =
+               init_parseptranslator();
        return translator;
 }
 
@@ -146,7 +147,8 @@ QuotesLangTranslator const init_quoteslangtranslator()
 
 QuotesLangTranslator const & quoteslangtranslator()
 {
-       static QuotesLangTranslator translator = init_quoteslangtranslator();
+       static QuotesLangTranslator const translator =
+               init_quoteslangtranslator();
        return translator;
 }
 
@@ -196,7 +198,8 @@ static PaperSizeTranslator initPaperSizeTranslator()
 
 PaperSizeTranslator const & papersizetranslator()
 {
-       static PaperSizeTranslator translator = initPaperSizeTranslator();
+       static PaperSizeTranslator const translator =
+               initPaperSizeTranslator();
        return translator;
 }
 
@@ -215,7 +218,8 @@ PaperOrientationTranslator const 
init_paperorientationtranslator()
 
 PaperOrientationTranslator const & paperorientationtranslator()
 {
-       static PaperOrientationTranslator translator = 
init_paperorientationtranslator();
+       static PaperOrientationTranslator const translator =
+           init_paperorientationtranslator();
        return translator;
 }
 
@@ -234,7 +238,7 @@ SidesTranslator const init_sidestranslator()
 
 SidesTranslator const & sidestranslator()
 {
-       static SidesTranslator translator = init_sidestranslator();
+       static SidesTranslator const translator = init_sidestranslator();
        return translator;
 }
 
@@ -254,7 +258,8 @@ PackageTranslator const init_packagetranslator()
 
 PackageTranslator const & packagetranslator()
 {
-       static PackageTranslator translator = init_packagetranslator();
+       static PackageTranslator const translator =
+               init_packagetranslator();
        return translator;
 }
 
@@ -274,7 +279,8 @@ CiteEngineTypeTranslator const 
init_citeenginetypetranslator()
 
 CiteEngineTypeTranslator const & citeenginetypetranslator()
 {
-       static CiteEngineTypeTranslator translator = 
init_citeenginetypetranslator();
+       static CiteEngineTypeTranslator const translator =
+               init_citeenginetypetranslator();
        return translator;
 }
 
@@ -296,7 +302,7 @@ SpaceTranslator const init_spacetranslator()
 
 SpaceTranslator const & spacetranslator()
 {
-       static SpaceTranslator translator = init_spacetranslator();
+       static SpaceTranslator const translator = init_spacetranslator();
        return translator;
 }
 
@@ -445,6 +451,8 @@ void BufferParams::use_package(std::string const & p, 
BufferParams::Package u)
 
 map<string, string> const & BufferParams::auto_packages()
 {
+       // FIXME THREAD
+       // It is extremely unlikely that there could be a problem here, but...
        static map<string, string> packages;
        if (packages.empty()) {
                // adding a package here implies a file format change!
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 7555f78..435a806 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1499,6 +1499,8 @@ void BufferView::dispatch(FuncRequest const & cmd, 
DispatchResult & dr)
 
        case LFUN_WORD_FIND_FORWARD:
        case LFUN_WORD_FIND_BACKWARD: {
+               // FIXME THREAD
+               // Would it maybe be better if this variable were view specific 
anyway?
                static docstring last_search;
                docstring searched_string;
 
diff --git a/src/Changes.cpp b/src/Changes.cpp
index d24df40..d03a371 100644
--- a/src/Changes.cpp
+++ b/src/Changes.cpp
@@ -348,6 +348,7 @@ docstring getLaTeXMarkup(docstring const & macro, docstring 
const & author,
        if (macro.empty())
                return docstring();
 
+       // FIXME THREAD
        static docstring warned_author = docstring();
        docstring uncodable_author = warned_author;
        odocstringstream ods;
diff --git a/src/ConverterCache.cpp b/src/ConverterCache.cpp
index 40390bc..e384cdc 100644
--- a/src/ConverterCache.cpp
+++ b/src/ConverterCache.cpp
@@ -49,6 +49,8 @@ unsigned long do_crc(string const & s)
 }
 
 
+// FIXME THREAD
+// This should be OK because it is only assigned during init()
 static FileName cache_dir;
 
 
diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp
index 9e7ddd3..23a1eca 100644
--- a/src/CutAndPaste.cpp
+++ b/src/CutAndPaste.cpp
@@ -483,6 +483,7 @@ void putClipboard(ParagraphList const & paragraphs,
        // to be so, but the alternative is to construct a new one of these 
(with a
        // new temporary directory, etc) every time, and then to destroy it. So 
maybe
        // it's worth just keeping this one around.
+       // FIXME THREAD
        static Buffer * staticbuffer = theBufferList().newInternalBuffer(
                FileName::tempName("clipboard.internal").absFileName());
 
diff --git a/src/FloatList.cpp b/src/FloatList.cpp
index 3ed9127..5725293 100644
--- a/src/FloatList.cpp
+++ b/src/FloatList.cpp
@@ -64,7 +64,7 @@ Floating const & FloatList::getType(string const & t) const
 #ifdef HAVE_EXCEPTIONS
        throw UnknownFloatType(t);
 #else
-       static Floating empty_float;
+       static Floating const empty_float;
        return empty_float;
 #endif
 }
diff --git a/src/FontList.cpp b/src/FontList.cpp
index efe1208..ba6b79a 100644
--- a/src/FontList.cpp
+++ b/src/FontList.cpp
@@ -53,13 +53,14 @@ FontList::const_iterator FontList::fontIterator(pos_type 
pos) const
 }
 
 
-Font & FontList::get(pos_type pos)
+Font const & FontList::get(pos_type pos)
 {
        iterator end = list_.end();
        iterator it = fontIterator(pos);
        if (it != end && it->pos() == pos)
                return it->font_;
-       static Font dummy;
+
+       static Font const dummy;
        return dummy;
 }
 
diff --git a/src/FontList.h b/src/FontList.h
index 61ab220..fed99fe 100644
--- a/src/FontList.h
+++ b/src/FontList.h
@@ -92,7 +92,7 @@ public:
        ///
        const_iterator fontIterator(pos_type pos) const;
        ///
-       Font & get(pos_type pos);
+       Font const & get(pos_type pos);
        ///
        void set(pos_type pos, Font const & font);
        ///
diff --git a/src/Format.cpp b/src/Format.cpp
index 2bc7ac5..c9e1381 100644
--- a/src/Format.cpp
+++ b/src/Format.cpp
@@ -477,6 +477,7 @@ struct ZippedInfo {
 };
 
 
+// FIXME THREAD
 /// Mapping absolute pathnames of files to their ZippedInfo metadata.
 static std::map<std::string, ZippedInfo> zipped_;
 
@@ -796,7 +797,7 @@ FlavorTranslator initFlavorTranslator()
 
 FlavorTranslator const & flavorTranslator()
 {
-       static FlavorTranslator translator = initFlavorTranslator();
+       static FlavorTranslator const translator = initFlavorTranslator();
        return translator;
 }
 
diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp
index 50833c9..23acee0 100644
--- a/src/KeyMap.cpp
+++ b/src/KeyMap.cpp
@@ -443,7 +443,7 @@ FuncRequest const & KeyMap::lookup(KeySymbol const &key,
                        if (cit->prefixes) {
                                // this is a prefix key - set new map
                                seq->curmap = cit->prefixes.get();
-                               static FuncRequest prefix(LFUN_COMMAND_PREFIX);
+                               static const FuncRequest 
prefix(LFUN_COMMAND_PREFIX);
                                return prefix;
                        } else {
                                // final key - reset map
diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp
index e4a23af..a6fd6f7 100644
--- a/src/LaTeX.cpp
+++ b/src/LaTeX.cpp
@@ -634,8 +634,8 @@ int LaTeX::scanLogFile(TeXErrors & terr)
        FileName const fn = FileName(makeAbsPath(tmp));
        ifstream ifs(fn.toFilesystemEncoding().c_str());
        bool fle_style = false;
-       static regex file_line_error(".+\\.\\D+:[0-9]+: (.+)");
-       static regex child_file(".*([0-9]+[A-Za-z]*_.+\\.tex).*");
+       static regex const file_line_error(".+\\.\\D+:[0-9]+: (.+)");
+       static regex const child_file(".*([0-9]+[A-Za-z]*_.+\\.tex).*");
        // Flag for 'File ended while scanning' message.
        // We need to wait for subsequent processing.
        string wait_for_error;
@@ -1215,7 +1215,7 @@ void LaTeX::deplog(DepTable & head)
                // (and in addition to those above)
                if (regex_match(token, sub, reg5)) {
                        // search for strings in <...>
-                       static regex reg5_1("<([^>]+)(.)");
+                       static regex const reg5_1("<([^>]+)(.)");
                        fragment_pos = iterateLine(token, reg5_1, ">",
                                                   fragment_pos, head);
                        fragment = (fragment_pos != -1);
@@ -1228,7 +1228,7 @@ void LaTeX::deplog(DepTable & head)
                // where "File: file.ext" would be skipped
                if (regex_match(token, sub, reg6)) {
                        // search for strings in (...)
-                       static regex reg6_1("\\(([^()]+)(.)");
+                       static regex const reg6_1("\\(([^()]+)(.)");
                        fragment_pos = iterateLine(token, reg6_1, ")",
                                                   fragment_pos, head);
                        fragment = (fragment_pos != -1);
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index c68729f..e20617f 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -428,6 +428,7 @@ void LaTeXFeatures::require(set<string> const & names)
 void LaTeXFeatures::useLayout(docstring const & layoutname)
 {
        // Some code to avoid loops in dependency definition
+       // FIXME THREAD
        static int level = 0;
        const int maxlevel = 30;
        if (level > maxlevel) {
diff --git a/src/Layout.cpp b/src/Layout.cpp
index 08540ef..b7b7d1d 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -775,6 +775,8 @@ void Layout::readLabelType(Lexer & lex)
 
 void Layout::readEndLabelType(Lexer & lex)
 {
+       // this should be const, but can't be because
+       // of PushPopHelper.
        static LexerKeyword endlabelTypeTags[] = {
                { "box",              END_LABEL_BOX },
                { "filled_box", END_LABEL_FILLED_BOX },
diff --git a/src/buffer_funcs.cpp b/src/buffer_funcs.cpp
index 26bff55..3f64b90 100644
--- a/src/buffer_funcs.cpp
+++ b/src/buffer_funcs.cpp
@@ -172,6 +172,7 @@ Buffer * newFile(string const & filename, string const & 
templatename,
 Buffer * newUnnamedFile(FileName const & path, string const & prefix,
                                                string const & templatename)
 {
+       // FIXME THREAD
        static map<string, int> file_number;
 
        FileName filename;
diff --git a/src/frontends/qt4/FindAndReplace.cpp 
b/src/frontends/qt4/FindAndReplace.cpp
index ce32a8e..e13f25d 100644
--- a/src/frontends/qt4/FindAndReplace.cpp
+++ b/src/frontends/qt4/FindAndReplace.cpp
@@ -146,12 +146,13 @@ bool FindAndReplaceWidget::eventFilter(QObject * obj, 
QEvent * event)
 
 static vector<string> const & allManualsFiles() 
 {
-       static vector<string> v;
        static const char * files[] = {
                "Intro", "UserGuide", "Tutorial", "Additional",
                "EmbeddedObjects", "Math", "Customization", "Shortcuts",
                "LFUNs", "LaTeXConfig"
        };
+
+       static vector<string> v;
        if (v.empty()) {
                FileName fname;
                for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); ++i) {
@@ -159,6 +160,7 @@ static vector<string> const & allManualsFiles()
                        v.push_back(fname.absFileName());
                }
        }
+
        return v;
 }
 
diff --git a/src/frontends/qt4/GuiCitation.cpp 
b/src/frontends/qt4/GuiCitation.cpp
index 84c9c82..5707955 100644
--- a/src/frontends/qt4/GuiCitation.cpp
+++ b/src/frontends/qt4/GuiCitation.cpp
@@ -54,6 +54,8 @@ using namespace lyx::support;
 namespace lyx {
 namespace frontend {
 
+// FIXME THREAD
+// I am guessing that it would not hurt to make these private members.
 static vector<string> citeCmds_;
 static vector<CitationStyle> citeStyles_;
 
@@ -539,6 +541,7 @@ void GuiCitation::findKey(BiblioInfo const & bi,
        docstring field, docstring entry_type,
        bool case_sensitive, bool reg_exp, bool reset)
 {
+       // FIXME THREAD
        // Used for optimisation: store last searched string.
        static QString last_searched_string;
        // Used to disable the above optimisation.
diff --git a/src/frontends/qt4/GuiDelimiter.cpp 
b/src/frontends/qt4/GuiDelimiter.cpp
index 8303fa6..975001b 100644
--- a/src/frontends/qt4/GuiDelimiter.cpp
+++ b/src/frontends/qt4/GuiDelimiter.cpp
@@ -141,7 +141,7 @@ MathSymbol const & mathSymbol(string tex_name)
        map<string, MathSymbol>::const_iterator it =
                math_symbols_.find(tex_name);
 
-       static MathSymbol unknown_symbol;
+       static MathSymbol const unknown_symbol;
        if (it == math_symbols_.end())
                return unknown_symbol;
 
@@ -154,7 +154,7 @@ string const & texName(char_type math_symbol)
        map<char_type, string>::const_iterator it =
                tex_names_.find(math_symbol);
 
-       static string empty_string;
+       static string const empty_string;
        if (it == tex_names_.end())
                return empty_string;
 
diff --git a/src/frontends/qt4/GuiDocument.cpp 
b/src/frontends/qt4/GuiDocument.cpp
index caa3d22..732c843 100644
--- a/src/frontends/qt4/GuiDocument.cpp
+++ b/src/frontends/qt4/GuiDocument.cpp
@@ -1471,6 +1471,7 @@ QString GuiDocument::validateListingsParameters()
 {
        // use a cache here to avoid repeated validation
        // of the same parameters
+       // FIXME THREAD
        static string param_cache;
        static QString msg_cache;
 
@@ -1488,6 +1489,7 @@ QString GuiDocument::validateListingsParameters()
 
 void GuiDocument::setListingsMessage()
 {
+       // FIXME THREAD
        static bool isOK = true;
        QString msg = validateListingsParameters();
        if (msg.isEmpty()) {
diff --git a/src/frontends/qt4/GuiFontLoader.cpp 
b/src/frontends/qt4/GuiFontLoader.cpp
index 8081cd6..9fd2060 100644
--- a/src/frontends/qt4/GuiFontLoader.cpp
+++ b/src/frontends/qt4/GuiFontLoader.cpp
@@ -345,6 +345,7 @@ GuiFontInfo::GuiFontInfo(FontInfo const & f)
 
 bool FontLoader::available(FontInfo const & f)
 {
+       // FIXME THREAD
        static vector<int> cache_set(NUM_FAMILIES, false);
        static vector<int> cache(NUM_FAMILIES, false);
 
diff --git a/src/frontends/qt4/GuiGraphics.cpp 
b/src/frontends/qt4/GuiGraphics.cpp
index 66bf836..3bc7b94 100644
--- a/src/frontends/qt4/GuiGraphics.cpp
+++ b/src/frontends/qt4/GuiGraphics.cpp
@@ -75,7 +75,7 @@ char const * const rorigin_gui_strs[] = {
 
 size_t const rorigin_size = sizeof(rorigin_lyx_strs) / sizeof(char *);
 
-static string autostr = N_("automatically");
+static string const autostr = N_("automatically");
 
 } // namespace anon
 
diff --git a/src/frontends/qt4/GuiInclude.cpp b/src/frontends/qt4/GuiInclude.cpp
index c0d7f81..fe8cc3b 100644
--- a/src/frontends/qt4/GuiInclude.cpp
+++ b/src/frontends/qt4/GuiInclude.cpp
@@ -93,6 +93,7 @@ docstring GuiInclude::validate_listings_params()
 {
        // use a cache here to avoid repeated validation
        // of the same parameters
+       // FIXME THREAD
        static string param_cache = string();
        static docstring msg_cache = docstring();
        
@@ -110,6 +111,7 @@ docstring GuiInclude::validate_listings_params()
 
 void GuiInclude::setListingsMsg()
 {
+       // FIXME THREAD
        static bool isOK = true;
        docstring msg = validate_listings_params();
        if (msg.empty()) {
diff --git a/src/frontends/qt4/GuiListings.cpp 
b/src/frontends/qt4/GuiListings.cpp
index 6591b55..da12882 100644
--- a/src/frontends/qt4/GuiListings.cpp
+++ b/src/frontends/qt4/GuiListings.cpp
@@ -348,6 +348,7 @@ docstring GuiListings::validate_listings_params()
 {
        // use a cache here to avoid repeated validation
        // of the same parameters
+       // FIXME THREAD
        static string param_cache;
        static docstring msg_cache;
        
@@ -365,6 +366,7 @@ docstring GuiListings::validate_listings_params()
 
 void GuiListings::setListingsMsg()
 {
+       // FIXME THREAD
        static bool isOK = true;
        docstring msg = validate_listings_params();
        if (msg.empty()) {
diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp
index 00a4131..40cd37e 100644
--- a/src/frontends/qt4/GuiPainter.cpp
+++ b/src/frontends/qt4/GuiPainter.cpp
@@ -198,6 +198,7 @@ void GuiPainter::lines(int const * xp, int const * yp, int 
np,
                return;
 
        // double the size if needed
+       // FIXME THREAD
        static QVector<QPoint> points(32);
        if (np > points.size())
                points.resize(2 * np);
diff --git a/src/frontends/qt4/GuiParagraph.cpp 
b/src/frontends/qt4/GuiParagraph.cpp
index 6cad137..306085d 100644
--- a/src/frontends/qt4/GuiParagraph.cpp
+++ b/src/frontends/qt4/GuiParagraph.cpp
@@ -311,7 +311,7 @@ ParagraphParameters const & GuiParagraph::params() const
        if (haveMultiParSelection()) {
                // FIXME: in case of multi-paragraph selection, it would be 
nice to
                // initialise the parameters that are common to all paragraphs.
-               static ParagraphParameters empty;
+               static ParagraphParameters const empty;
                return empty;
        }
        return bufferview()->cursor().innerParagraph().params();
diff --git a/src/frontends/qt4/GuiSymbols.cpp b/src/frontends/qt4/GuiSymbols.cpp
index 743cab7..c930504 100644
--- a/src/frontends/qt4/GuiSymbols.cpp
+++ b/src/frontends/qt4/GuiSymbols.cpp
@@ -153,6 +153,7 @@ const int no_blocks = sizeof(unicode_blocks) / 
sizeof(UnicodeBlocks);
 QString getBlock(char_type c)
 {
        // store an educated guess for the next search
+       // FIXME THREAD
        static int lastBlock = 0;
 
        // "clever reset"
@@ -226,6 +227,7 @@ public:
                static QString const strCharacter = qt_("Character: ");
                static QString const strCodePoint = qt_("Code Point: ");
 
+               // FIXME THREAD
                static char codeName[10];
 
                char_type c = symbols_.at(index.row()); 
diff --git a/src/frontends/qt4/GuiViewSource.cpp 
b/src/frontends/qt4/GuiViewSource.cpp
index edc1dea..b2df874 100644
--- a/src/frontends/qt4/GuiViewSource.cpp
+++ b/src/frontends/qt4/GuiViewSource.cpp
@@ -115,6 +115,9 @@ static bool getContent(BufferView const * view, 
Buffer::OutputWhat output,
        view->buffer().getSourceCode(ostr, format, par_begin, par_end + 1,
                                     output, master);
        docstring s = ostr.str();
+       // FIXME THREAD
+       // Could this be private to this particular dialog? We could have
+       // more than one of these, in different windows.
        static size_t crc = 0;
        size_t newcrc = crcCheck(s);
        if (newcrc == crc && !force_getcontent)
diff --git a/src/frontends/qt4/GuiWorkArea.cpp 
b/src/frontends/qt4/GuiWorkArea.cpp
index 024c680..981420d 100644
--- a/src/frontends/qt4/GuiWorkArea.cpp
+++ b/src/frontends/qt4/GuiWorkArea.cpp
@@ -1210,6 +1210,8 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e)
                stopBlinkingCursor();
 
        // last_width : for checking if last preedit string was/wasn't empty.
+       // FIXME THREAD
+       // We could have more than one work area, right?
        static bool last_width = false;
        if (!last_width && preedit_string.empty()) {
                // if last_width is last length of preedit string.
diff --git a/src/graphics/GraphicsConverter.cpp 
b/src/graphics/GraphicsConverter.cpp
index 207c58c..4930f0d 100644
--- a/src/graphics/GraphicsConverter.cpp
+++ b/src/graphics/GraphicsConverter.cpp
@@ -142,6 +142,7 @@ Converter::Impl::Impl(FileName const & from_file, string 
const & to_file_base,
                << "\n--------------------------------------\n");
 
        // Output the script to file.
+       // FIXME THREAD
        static int counter = 0;
        script_file_ = FileName(onlyPath(to_file_base) + "lyxconvert" +
                convert<string>(counter++) + ".py");
@@ -288,6 +289,7 @@ static void build_script(string const & from_file,
 
        // Create a temporary base file-name for all intermediate steps.
        // Remember to remove the temp file because we only want the name...
+       // FIXME THREAD
        static int counter = 0;
        string const tmp = "gconvert" + convert<string>(counter++);
        string const to_base = FileName::tempName(tmp).toFilesystemEncoding();
diff --git a/src/graphics/GraphicsLoader.cpp b/src/graphics/GraphicsLoader.cpp
index 9f873ba..4ec5c9a 100644
--- a/src/graphics/GraphicsLoader.cpp
+++ b/src/graphics/GraphicsLoader.cpp
@@ -74,6 +74,7 @@ private:
 //static int s_numimages_ = 5;
 //static int s_millisecs_ = 500;
 
+// FIXME THREAD
 static int s_numimages_ = 10;
 static int s_millisecs_ = 500;
 
diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp
index b4d78e0..a88b6e4 100644
--- a/src/graphics/PreviewLoader.cpp
+++ b/src/graphics/PreviewLoader.cpp
@@ -61,6 +61,7 @@ typedef vector<SnippetPair> BitmapFile;
 
 string const unique_filename(string const & bufferpath)
 {
+       // FIXME THREAD
        static int theCounter = 0;
        string const filename = lyx::convert<string>(theCounter++) + 
"lyxpreview";
        return addName(bufferpath, filename);
@@ -85,6 +86,7 @@ lyx::Converter const * setConverter(string const from)
                        return ptr;
        }
 
+       // FIXME THREAD
        static bool first = true;
        if (first) {
                first = false;
@@ -618,6 +620,7 @@ void PreviewLoader::Impl::startLoading(bool wait)
        if (wait) {
                ForkedCall call(buffer_.filePath());
                int ret = call.startScript(ForkedProcess::Wait, command);
+               // FIXME THREAD
                static int fake = (2^20) + 1;
                int pid = fake++;
                inprogress.pid = pid;
diff --git a/src/insets/InsetBibitem.cpp b/src/insets/InsetBibitem.cpp
index 2840ad5..3da71d5 100644
--- a/src/insets/InsetBibitem.cpp
+++ b/src/insets/InsetBibitem.cpp
@@ -48,6 +48,7 @@ using namespace lyx::support;
 namespace lyx {
 
 
+// FIXME THREAD
 int InsetBibitem::key_counter = 0;
 docstring const key_prefix = from_ascii("key-");
 
diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp
index 30c2386..c96a7c9 100644
--- a/src/insets/InsetBox.cpp
+++ b/src/insets/InsetBox.cpp
@@ -78,14 +78,14 @@ BoxTranslatorLoc initBoxtranslatorLoc()
 
 BoxTranslator const & boxtranslator()
 {
-       static BoxTranslator translator = initBoxtranslator();
+       static BoxTranslator const translator = initBoxtranslator();
        return translator;
 }
 
 
 BoxTranslatorLoc const & boxtranslator_loc()
 {
-       static BoxTranslatorLoc translator = initBoxtranslatorLoc();
+       static BoxTranslatorLoc const translator = initBoxtranslatorLoc();
        return translator;
 }
 
diff --git a/src/insets/InsetIPAMacro.cpp b/src/insets/InsetIPAMacro.cpp
index 38cf145..21f2d11 100644
--- a/src/insets/InsetIPAMacro.cpp
+++ b/src/insets/InsetIPAMacro.cpp
@@ -59,14 +59,16 @@ IPADecoTranslatorLoc const init_ipadecotranslator_loc()
 
 IPADecoTranslator const & ipadecotranslator()
 {
-       static IPADecoTranslator decotranslator = init_ipadecotranslator();
+       static IPADecoTranslator const decotranslator =
+                       init_ipadecotranslator();
        return decotranslator;
 }
 
 
 IPADecoTranslatorLoc const & ipadecotranslator_loc()
 {
-       static IPADecoTranslatorLoc translator = init_ipadecotranslator_loc();
+       static IPADecoTranslatorLoc const translator =
+           init_ipadecotranslator_loc();
        return translator;
 }
 
@@ -86,7 +88,8 @@ IPACharTranslator const init_ipachartranslator()
 
 IPACharTranslator const & ipachartranslator()
 {
-       static IPACharTranslator chartranslator = init_ipachartranslator();
+       static IPACharTranslator const chartranslator =
+           init_ipachartranslator();
        return chartranslator;
 }
 
diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp
index d531662..506f358 100644
--- a/src/insets/InsetInclude.cpp
+++ b/src/insets/InsetInclude.cpp
@@ -76,6 +76,7 @@ namespace {
 
 docstring const uniqueID()
 {
+       // FIXME THREAD
        static unsigned int seed = 1000;
        return "file" + convert<docstring>(++seed);
 }
diff --git a/src/insets/InsetNote.cpp b/src/insets/InsetNote.cpp
index 19f6035..7511708 100644
--- a/src/insets/InsetNote.cpp
+++ b/src/insets/InsetNote.cpp
@@ -63,7 +63,7 @@ NoteTranslator const init_notetranslator()
 
 NoteTranslator const & notetranslator()
 {
-       static NoteTranslator translator = init_notetranslator();
+       static NoteTranslator const translator = init_notetranslator();
        return translator;
 }
 
diff --git a/src/insets/InsetPhantom.cpp b/src/insets/InsetPhantom.cpp
index f7a9b45..429fe33 100644
--- a/src/insets/InsetPhantom.cpp
+++ b/src/insets/InsetPhantom.cpp
@@ -71,14 +71,16 @@ PhantomTranslatorLoc const init_phantomtranslator_loc()
 
 PhantomTranslator const & phantomtranslator()
 {
-       static PhantomTranslator translator = init_phantomtranslator();
+       static PhantomTranslator const translator =
+           init_phantomtranslator();
        return translator;
 }
 
 
 PhantomTranslatorLoc const & phantomtranslator_loc()
 {
-       static PhantomTranslatorLoc translator = init_phantomtranslator_loc();
+       static PhantomTranslatorLoc const translator =
+           init_phantomtranslator_loc();
        return translator;
 }
 
diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp
index 9a2ddd8..a3f0596 100644
--- a/src/insets/InsetRef.cpp
+++ b/src/insets/InsetRef.cpp
@@ -351,7 +351,7 @@ void InsetRef::validate(LaTeXFeatures & features) const
 }
 
 
-InsetRef::type_info InsetRef::types[] = {
+InsetRef::type_info const InsetRef::types[] = {
        { "ref",       N_("Standard"),              N_("Ref: ")},
        { "eqref",     N_("Equation"),              N_("EqRef: ")},
        { "pageref",   N_("Page Number"),           N_("Page: ")},
diff --git a/src/insets/InsetRef.h b/src/insets/InsetRef.h
index 21a7ec1..7cd0a11 100644
--- a/src/insets/InsetRef.h
+++ b/src/insets/InsetRef.h
@@ -28,7 +28,7 @@ public:
                ///
                std::string short_gui_name;
        };
-       static type_info types[];
+       static const type_info types[];
        ///
        static int getType(std::string const & name);
        ///
diff --git a/src/insets/InsetScript.cpp b/src/insets/InsetScript.cpp
index c98a9be..779464c 100644
--- a/src/insets/InsetScript.cpp
+++ b/src/insets/InsetScript.cpp
@@ -68,14 +68,16 @@ ScriptTranslatorLoc const init_scripttranslator_loc()
 
 ScriptTranslator const & scripttranslator()
 {
-       static ScriptTranslator translator = init_scripttranslator();
+       static ScriptTranslator const translator =
+           init_scripttranslator();
        return translator;
 }
 
 
 ScriptTranslatorLoc const & scripttranslator_loc()
 {
-       static ScriptTranslatorLoc translator = init_scripttranslator_loc();
+       static ScriptTranslatorLoc const translator =
+           init_scripttranslator_loc();
        return translator;
 }
 
diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index 31211d1..312199d 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -53,6 +53,10 @@ enum OpenEncoding {
        CJK
 };
 
+// FIXME THREAD
+// There could easily be a conflict here, with the export process
+// setting this one way, and a View>Source process (possbily for
+// another Buffer) resetting it.
 static int open_encoding_ = none;
 static int cjk_inherited_ = 0;
 Language const * prev_env_language_ = 0;
diff --git a/src/sgml.cpp b/src/sgml.cpp
index 4842b07..3153ce3 100644
--- a/src/sgml.cpp
+++ b/src/sgml.cpp
@@ -104,6 +104,9 @@ 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;
        return label + convert<docstring>(++seed);
 }
@@ -132,6 +135,7 @@ 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;
diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp
index f048930..47d6669 100644
--- a/src/support/FileName.cpp
+++ b/src/support/FileName.cpp
@@ -925,6 +925,9 @@ string DocFileName::outputFileName(string const & path) 
const
 
 string DocFileName::mangledFileName(string const & dir) const
 {
+       // FIXME THREAD
+       // Concurrent access to these variables is possible.
+
        // We need to make sure that every DocFileName instance for a given
        // filename returns the same mangled name.
        typedef map<string, string> MangledMap;
@@ -954,6 +957,7 @@ string DocFileName::mangledFileName(string const & dir) 
const
        // Add the extension back on
        mname = support::changeExtension(mname, getExtension(name));
 
+       // FIXME THREAD
        // Prepend a counter to the filename. This is necessary to make
        // the mangled name unique.
        static int counter = 0;
diff --git a/src/support/Systemcall.cpp b/src/support/Systemcall.cpp
index de5de61..2d04fd6 100644
--- a/src/support/Systemcall.cpp
+++ b/src/support/Systemcall.cpp
@@ -78,7 +78,7 @@ public:
 };
 
 
-static ProgressInterface* progress_instance = 0;
+static ProgressInterface * progress_instance = 0;
 
 void ProgressInterface::setInstance(ProgressInterface* p)
 {
@@ -86,7 +86,7 @@ void ProgressInterface::setInstance(ProgressInterface* p)
 }
 
 
-ProgressInterface* ProgressInterface::instance()
+ProgressInterface * ProgressInterface::instance()
 {
        if (!progress_instance) {
                static ProgressDummy dummy;
diff --git a/src/support/debug.cpp b/src/support/debug.cpp
index 3a6f901..02bc817 100644
--- a/src/support/debug.cpp
+++ b/src/support/debug.cpp
@@ -202,7 +202,7 @@ char const * LyXErr::stripName(char const * n)
 {
        string const name = n;
        // find the last occurence of /src/ in name
-       static regex re("[\\/]src[\\/]");
+       static const regex re("[\\/]src[\\/]");
        string::const_iterator const begin = name.begin();
        string::const_iterator it = begin;
        string::const_iterator const end = name.end();
diff --git a/src/support/environment.cpp b/src/support/environment.cpp
index 813d418..ceaca60 100644
--- a/src/support/environment.cpp
+++ b/src/support/environment.cpp
@@ -75,6 +75,7 @@ bool setEnv(string const & name, string const & value)
        // the argument of putenv() needs to be static, because changing its
        // value will change the environment. Therefore we need a different 
static
        // storage for each variable.
+       // FIXME THREAD
        static map<string, string> varmap;
        varmap[name] = name + '=' + encoded;
        return ::putenv(const_cast<char*>(varmap[name].c_str())) == 0;
diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp
index 92aeaf7..d241fcc 100644
--- a/src/support/filetools.cpp
+++ b/src/support/filetools.cpp
@@ -574,8 +574,8 @@ string const replaceEnvironmentPath(string const & path)
        // $[A-Za-z_][A-Za-z_0-9]*
        static string const envvar = "[$]([A-Za-z_][A-Za-z_0-9]*)";
 
-       static regex envvar_br_re("(.*)" + envvar_br + "(.*)");
-       static regex envvar_re("(.*)" + envvar + "(.*)");
+       static regex const envvar_br_re("(.*)" + envvar_br + "(.*)");
+       static regex const envvar_re("(.*)" + envvar + "(.*)");
        string result = path;
        while (1) {
                smatch what;
diff --git a/src/support/lstrings.cpp b/src/support/lstrings.cpp
index 7af8aae..656f82e 100644
--- a/src/support/lstrings.cpp
+++ b/src/support/lstrings.cpp
@@ -32,7 +32,7 @@ namespace lyx {
 // without #include "support/docstring" there.
 docstring const & empty_docstring()
 {
-       static docstring s;
+       static const docstring s;
        return s;
 }
 
@@ -40,7 +40,7 @@ docstring const & empty_docstring()
 // without #include <string>
 string const & empty_string()
 {
-       static string s;
+       static const string s;
        return s;
 }
 
diff --git a/src/support/os.cpp b/src/support/os.cpp
index 8f60c68..b1537e3 100644
--- a/src/support/os.cpp
+++ b/src/support/os.cpp
@@ -62,6 +62,7 @@ int timeout_min()
 
 string const python(bool reset)
 {
+       // FIXME THREAD
        // Check whether the first python in PATH is the right one.
        static string command = python2("python -tt");
        if (reset) {

Reply via email to