]> git.lyx.org Git - lyx.git/commitdiff
This is the result of an audit of all static variables, looking
authorRichard Heck <rgheck@lyx.org>
Mon, 7 Oct 2013 22:59:05 +0000 (18:59 -0400)
committerRichard Heck <rgheck@lyx.org>
Mon, 21 Apr 2014 15:51:57 +0000 (11:51 -0400)
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.

51 files changed:
src/BiblioInfo.cpp
src/Buffer.cpp
src/BufferList.cpp
src/BufferParams.cpp
src/BufferView.cpp
src/Changes.cpp
src/ConverterCache.cpp
src/CutAndPaste.cpp
src/FloatList.cpp
src/FontList.cpp
src/FontList.h
src/Format.cpp
src/KeyMap.cpp
src/LaTeX.cpp
src/LaTeXFeatures.cpp
src/Layout.cpp
src/buffer_funcs.cpp
src/frontends/qt4/FindAndReplace.cpp
src/frontends/qt4/GuiCitation.cpp
src/frontends/qt4/GuiDelimiter.cpp
src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/GuiFontLoader.cpp
src/frontends/qt4/GuiGraphics.cpp
src/frontends/qt4/GuiInclude.cpp
src/frontends/qt4/GuiListings.cpp
src/frontends/qt4/GuiPainter.cpp
src/frontends/qt4/GuiParagraph.cpp
src/frontends/qt4/GuiSymbols.cpp
src/frontends/qt4/GuiViewSource.cpp
src/frontends/qt4/GuiWorkArea.cpp
src/graphics/GraphicsConverter.cpp
src/graphics/GraphicsLoader.cpp
src/graphics/PreviewLoader.cpp
src/insets/InsetBibitem.cpp
src/insets/InsetBox.cpp
src/insets/InsetIPAMacro.cpp
src/insets/InsetInclude.cpp
src/insets/InsetNote.cpp
src/insets/InsetPhantom.cpp
src/insets/InsetRef.cpp
src/insets/InsetRef.h
src/insets/InsetScript.cpp
src/output_latex.cpp
src/sgml.cpp
src/support/FileName.cpp
src/support/Systemcall.cpp
src/support/debug.cpp
src/support/environment.cpp
src/support/filetools.cpp
src/support/lstrings.cpp
src/support/os.cpp

index a50a865318485004bf338002b4a89425ed8a7710..7c776109655018c4af8516b5866a4be1c16fb7e1 100644 (file)
@@ -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
index ab2164b82b7949d3f68254ea7717d4e95d212517..6f7a5cd63f0fb8bd40b912c431a056dcf7304214 100644 (file)
@@ -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
index 341ddf455bdcbd5ba83a412aad846909ec82aa91..de5a7ab2ad56fd327d8bbe47aac146b1d2f55c77 100644 (file)
@@ -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();
index 3b85ff7a192b3ccf80f25be8b6a1322305050320..a70bc9e5cdf0ea0e48b94d38253514a748f59f58 100644 (file)
@@ -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!
index 7555f78633dd11b10e299018fcc2d80d17c51de5..435a806f06f0cf162f65ddb8fd0fd6d2eecb79bb 100644 (file)
@@ -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;
 
index d24df403ccf07f478d54792b71cc781aac711466..d03a371d937b6ff815506b9b4decaf883e2bb20b 100644 (file)
@@ -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;
index 40390bca8e175aedb680177eaf95965f7a0a8205..e384cdc8281a97b2b458b87a785eb409fbe2d1dd 100644 (file)
@@ -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;
 
 
index 9e7ddd31feaf3987bc393ec33b7fa572e48f2cd2..23a1eca14068c098a78978e06b5905681eccc30c 100644 (file)
@@ -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());
 
index 3ed9127d39a45a548da47aa02846a2299f324846..5725293c48970c05cc25ba2b7253fc5995e216c5 100644 (file)
@@ -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
 }
index efe1208f2f59ba5f0895efef18fd36d170b3e902..ba6b79af05bc2738f67ac809984a6a1b72d5fd86 100644 (file)
@@ -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;
 }
 
index 61ab2205f244d3d78f122ff7cf13d1d4e560dc6e..fed99fe8fc08d34c14ae29bbb565312d68fc79f1 100644 (file)
@@ -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);
        ///
index 2bc7ac534b745139e79e6282dbf0bd291c4a12c1..c9e1381992ffd80cb232ad7b179d5bea7910a232 100644 (file)
@@ -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;
 }
 
index 50833c923a755d694fd7042082aca99362cc6156..23acee0f9feb3185db9ccfbddace6d0a30829166 100644 (file)
@@ -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
index e4a23af117be4ede11a6b46d2b12e3bcec9d86a7..a6fd6f7983eb5288a5f3b98568520d5e0443c6d3 100644 (file)
@@ -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);
index c68729f5aaf47768595126991941f1b3b511b176..e20617f1c8a01ff3095b390236d125d41539ccc8 100644 (file)
@@ -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) {
index 08540efd15b119b4b08497749b67c0ece75aadcd..b7b7d1db8236bab800b734eca351295314b99beb 100644 (file)
@@ -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 },
index 26bff558f6402ea4aeae81e78f3c99b03d6516af..3f64b909f2ce827b9b0262131f1c430fe9ac4417 100644 (file)
@@ -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;
index ce32a8eb98be927c7056d1c9ea5c0eb98b0255f6..e13f25d48278aad1d1b391cf0807d1ff18490b59 100644 (file)
@@ -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;
 }
 
index 84c9c8255741349b8ce62bce94b13509d0be2c29..57079551787197ad0ae22f4128c73e9cc5f633fa 100644 (file)
@@ -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.
index 8303fa64140783ed24b136acbb5b6c544c88feb7..975001b8ea544d2e141bf3fb40d36fe5a922b2ec 100644 (file)
@@ -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;
 
index caa3d22d2e2c6d2fbf11393b2560250a5868e324..732c8430c85e2732b7d980f6de8343830e6219f1 100644 (file)
@@ -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()) {
index 8081cd6dca7618573038f885a7949cb3cd6c8f6f..9fd2060b429b81a19620aaed115692922f2f57cf 100644 (file)
@@ -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);
 
index 66bf83661f9ebdcc55cec0c3f0df2526bc2dcff0..3bc7b943bec2342cb630e5f14c246cb4858ad9b4 100644 (file)
@@ -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
 
index c0d7f81726895e6bbe04fe4a5ed30ff71c32d8db..fe8cc3ba5bb086e2cb9bdcbb534d1a0c6935815c 100644 (file)
@@ -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()) {
index 6591b5550c8c896e5ace0211ae2c9091f7b1dd26..da128829e69bd3cbb0446f4d379af34f7f79f480 100644 (file)
@@ -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()) {
index 00a4131e9b636a39314664b2f1c4baa047607f41..40cd37ea16eeab15f5019e23d039a52b19b71500 100644 (file)
@@ -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);
index 6cad13767308076f0881beec28e7ee244d43d5a6..306085dd08d962a50289b03dc3541718d358965a 100644 (file)
@@ -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();
index 743cab70065e431c103dce2c4e74e4dca40c4536..c9305042ee6d03a8fce69280f0c86d1ecb4d62d4 100644 (file)
@@ -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()); 
index edc1deaa1bb71395b08f9d7fe9d19b9706f404a1..b2df874437206bde096e139e8559bd5bab06ac1b 100644 (file)
@@ -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)
index 024c68002c89ac3e68e8a68db0a152fff897c3b3..981420d3b5e93da1ed8c549a40f3f216d4f233f5 100644 (file)
@@ -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.
index 207c58cb7b37f722e41d43015b74c50b9f4fc5fc..4930f0d7a0a98888726df8f706d7652ff751b036 100644 (file)
@@ -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();
index 9f873baf3db09e56c4fccd14b28e2c06b264d015..4ec5c9aed92f50a3443a82741f9429bfa0eab199 100644 (file)
@@ -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;
 
index b4d78e0ab5b68503d21445c7a2b652ecda124d90..a88b6e496c630a3b275496c1652b89a9a79404ef 100644 (file)
@@ -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;
index 2840ad5c8fff621f51992f53c8595845513940d3..3da71d51d183c0824172b93fd65ef16f9316a961 100644 (file)
@@ -48,6 +48,7 @@ using namespace lyx::support;
 namespace lyx {
 
 
+// FIXME THREAD
 int InsetBibitem::key_counter = 0;
 docstring const key_prefix = from_ascii("key-");
 
index 30c238671b6d705c48aa8b9ab6eb184995f97c4b..c96a7c9e7d11375d5a2fac0ec9537743a63fe0c1 100644 (file)
@@ -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;
 }
 
index 38cf14583b3c40010f287eca2dfb8df8287ad66b..21f2d114601cde4680031af70f4a932b9ebbe883 100644 (file)
@@ -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;
 }
 
index d53166267b7aa1c3693a27d4405f60d9d5b0d1be..506f3586e071e50f833578198cd83bb4a7d4a4ca 100644 (file)
@@ -76,6 +76,7 @@ namespace {
 
 docstring const uniqueID()
 {
+       // FIXME THREAD
        static unsigned int seed = 1000;
        return "file" + convert<docstring>(++seed);
 }
index 19f6035e0738e54b7007954109597f49ec6c497e..751170897ab5f60d707e06040d8d07d1ea8ebc1c 100644 (file)
@@ -63,7 +63,7 @@ NoteTranslator const init_notetranslator()
 
 NoteTranslator const & notetranslator()
 {
-       static NoteTranslator translator = init_notetranslator();
+       static NoteTranslator const translator = init_notetranslator();
        return translator;
 }
 
index f7a9b45d9a732fa859c7be6cde82365c2ce23efb..429fe331e42a9f94804253a1ff73a23ef9718075 100644 (file)
@@ -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;
 }
 
index 9a2ddd8bd8aec618719ba9c4b7bb561d1564a2ca..a3f059672095da39b251e8e95a9b222833477ab6 100644 (file)
@@ -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: ")},
index 21a7ec1c7c5a21514120c5c911001f93665bd285..7cd0a11cfd27cf674c544e512993f5e300951761 100644 (file)
@@ -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);
        ///
index c98a9bed483bc3304922edec054eb0fd541a5359..779464c7cd84009463d160963ec0da1bcf725000 100644 (file)
@@ -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;
 }
 
index 31211d1c8554cc01c6897cfe9bc2aaadc1a30e72..312199d62c0f39405fb0aba242c9a9ac547ed960 100644 (file)
@@ -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;
index 4842b07912e8f2f4524782a12093a5b3865174b8..3153ce37200113934c4eaafa5fe9c405d64fc0b3 100644 (file)
@@ -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;
index f0489309d549ae44a61df42c888225eb23eadfe5..47d66699e73e5ccbde4a973bb854e1db25711aca 100644 (file)
@@ -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;
index de5de6196195a9e0c842b92e44b6888f2e08a371..2d04fd6f363ae6a138e6ba59234593dd0cd93f9d 100644 (file)
@@ -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;
index 3a6f9018feb3926549c5af73e125c406b6279d7f..02bc8175edd237f8701021be13e79320bb4a1f9c 100644 (file)
@@ -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();
index 813d418d9a9dcd2f8c418371ca6332bfbca92603..ceaca60f547d86aebc21b295a424b4f08395fb13 100644 (file)
@@ -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;
index 92aeaf7fb4c8beeedfacc840c880ab243d5187a1..d241fcc495a6131fce7d99692717b327792b6077 100644 (file)
@@ -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;
index 7af8aae34e9a50b52b2aa716148b499394a87dfe..656f82ee1119b7010d0f41f5b350304077efec60 100644 (file)
@@ -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;
 }
 
index 8f60c68fb4c5339e60cc8c4e4a56898c6416006b..b1537e3655984d7d5def27a44d74d7b6e2de33a3 100644 (file)
@@ -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) {