mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
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.
This commit is contained in:
parent
3d6790607e
commit
fdbe775b9f
@ -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
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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!
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
///
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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 },
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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()) {
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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()) {
|
||||
|
@ -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()) {
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
|
@ -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)
|
||||
|
@ -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.
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -48,6 +48,7 @@ using namespace lyx::support;
|
||||
namespace lyx {
|
||||
|
||||
|
||||
// FIXME THREAD
|
||||
int InsetBibitem::key_counter = 0;
|
||||
docstring const key_prefix = from_ascii("key-");
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,7 @@ namespace {
|
||||
|
||||
docstring const uniqueID()
|
||||
{
|
||||
// FIXME THREAD
|
||||
static unsigned int seed = 1000;
|
||||
return "file" + convert<docstring>(++seed);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ NoteTranslator const init_notetranslator()
|
||||
|
||||
NoteTranslator const & notetranslator()
|
||||
{
|
||||
static NoteTranslator translator = init_notetranslator();
|
||||
static NoteTranslator const translator = init_notetranslator();
|
||||
return translator;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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: ")},
|
||||
|
@ -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);
|
||||
///
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user