commit fd4a817f908d00088fed4843da3d896c302f5743
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Sun Mar 16 21:10:04 2025 +0100
Fixup 724ca831: use a LaTeXFeature member instead of a static variable
Also avoid guarding the validation of the parameters of the macro.
Related to bug #12633.
---
src/LaTeXFeatures.h | 4 ++++
src/mathed/InsetMathMacro.cpp | 9 +++------
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h
index af1c1cfded..df0f4f3572 100644
--- a/src/LaTeXFeatures.h
+++ b/src/LaTeXFeatures.h
@@ -187,6 +187,8 @@ public:
docstring const & htmlTitle() const { return htmltitle_; }
///
bool hasRTLLanguage() const;
+ /// This is used to avoid recursion in InsetMathMacro::validate
+ std::set<docstring> & activeMacros() { return active_macros_; }
private:
///
@@ -241,6 +243,8 @@ private:
docstring htmltitle_;
///
std::string savenote_env_;
+ /// This is used to avoid recursion in InsetMathMacro::validate
+ std::set<docstring> active_macros_;
};
diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp
index 6e209a0e5f..3318799d09 100644
--- a/src/mathed/InsetMathMacro.cpp
+++ b/src/mathed/InsetMathMacro.cpp
@@ -957,12 +957,9 @@ MacroData const * InsetMathMacro::macroBackup() const
void InsetMathMacro::validate(LaTeXFeatures & features) const
{
// Protect against recursive macros
- static set<docstring> active_macros;
- if (active_macros.count(name())) {
- LYXERR0("Recursive nesting for " << name());
+ if (features.activeMacros().count(name()))
return;
- }
- active_macros.insert(name());
+ features.activeMacros().insert(name());
// Immediately after a document is loaded, in some cases the MacroData
// of the global macros defined in the lib/symbols file may still not
@@ -1000,8 +997,8 @@ void InsetMathMacro::validate(LaTeXFeatures & features)
const
}
}
}
+ features.activeMacros().erase(name());
InsetMathNest::validate(features);
- active_macros.erase(name());
}
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs