mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-12 22:14:35 +00:00
Fix missing updates for lazy MacroData
Not all accessors did update the data previously. Therefore it could happen that document export from the command line would output \newcommand, and from GUI it would output \renewcommand for the same macro, simply because in the GUI case the data was updated as a side effect of the GUI thread reading some other member. I also removed the mutable flag for requires_, since this member is always set on construction and does not need any lazy update.
This commit is contained in:
parent
50af06c29b
commit
561c5bfd50
@ -46,7 +46,6 @@ MacroData::MacroData(Buffer * buf)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
MacroData::MacroData(Buffer * buf, DocIterator const & pos)
|
||||
: buffer_(buf), pos_(pos), queried_(false), numargs_(0),
|
||||
optionals_(0), lockCount_(0), redefinition_(false),
|
||||
|
@ -58,9 +58,9 @@ public:
|
||||
///
|
||||
std::vector<docstring> const & defaults() const;
|
||||
///
|
||||
std::string const & requires() const { updateData(); return requires_; }
|
||||
std::string const & requires() const { return requires_; }
|
||||
///
|
||||
std::string & requires() { updateData(); return requires_; }
|
||||
std::string & requires() { return requires_; }
|
||||
|
||||
/// lock while being drawn to avoid recursions
|
||||
int lock() const { return ++lockCount_; }
|
||||
@ -70,14 +70,10 @@ public:
|
||||
void unlock() const;
|
||||
|
||||
///
|
||||
bool redefinition() const { return redefinition_; }
|
||||
///
|
||||
void setRedefinition(bool redefined) { redefinition_ = redefined; }
|
||||
bool redefinition() const { updateData(); return redefinition_; }
|
||||
|
||||
///
|
||||
MacroType type() const { return type_; }
|
||||
///
|
||||
MacroType & type() { return type_; }
|
||||
MacroType type() const { updateData(); return type_; }
|
||||
|
||||
/// output as TeX macro, only works for lazy MacroData!!!
|
||||
int write(odocstream & os, bool overwriteRedefinition) const;
|
||||
@ -121,7 +117,7 @@ private:
|
||||
///
|
||||
mutable docstring display_;
|
||||
///
|
||||
mutable std::string requires_;
|
||||
std::string requires_;
|
||||
///
|
||||
mutable size_t optionals_;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user