mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Fix bug #8999 by locking math macros while they are updating.
This commit is contained in:
parent
99059742c6
commit
e86cdc4020
@ -312,9 +312,27 @@ void MathMacro::updateMacro(MacroContext const & mc)
|
||||
}
|
||||
|
||||
|
||||
class MathMacro::UpdateLocker
|
||||
{
|
||||
public:
|
||||
explicit UpdateLocker(MathMacro & mm) : mac(mm)
|
||||
{
|
||||
mac.isUpdating_ = true;
|
||||
}
|
||||
~UpdateLocker() { mac.isUpdating_ = false; }
|
||||
private:
|
||||
MathMacro & mac;
|
||||
};
|
||||
|
||||
|
||||
void MathMacro::updateRepresentation(Cursor * cur, MacroContext const & mc,
|
||||
UpdateType utype)
|
||||
{
|
||||
if (isUpdating_)
|
||||
return;
|
||||
|
||||
UpdateLocker(*this);
|
||||
|
||||
// known macro?
|
||||
if (macro_ == 0)
|
||||
return;
|
||||
|
@ -183,6 +183,10 @@ private:
|
||||
std::string requires_;
|
||||
/// update macro representation
|
||||
bool needsUpdate_;
|
||||
/// update lock to avoid loops
|
||||
class UpdateLocker;
|
||||
friend class UpdateLocker;
|
||||
bool isUpdating_;
|
||||
/// maximal number of arguments the macro is greedy for
|
||||
size_t appetite_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user