It was broken in two ways: It was not threadsafe, and it did never detect
any recursion, since the counter was decremented for each non-recursive call
and never incremented again.
void LaTeXFeatures::useLayout(docstring const & layoutname)
void LaTeXFeatures::useLayout(docstring const & layoutname)
+{
+ useLayout(layoutname, 0);
+}
+
+
+void LaTeXFeatures::useLayout(docstring const & layoutname, int level)
{
// Some code to avoid loops in dependency definition
{
// Some code to avoid loops in dependency definition
- // FIXME THREAD
- static int level = 0;
const int maxlevel = 30;
if (level > maxlevel) {
lyxerr << "LaTeXFeatures::useLayout: maximum level of "
const int maxlevel = 30;
if (level > maxlevel) {
lyxerr << "LaTeXFeatures::useLayout: maximum level of "
require(layout.requires());
if (!layout.depends_on().empty()) {
require(layout.requires());
if (!layout.depends_on().empty()) {
- ++level;
- useLayout(layout.depends_on());
- --level;
+ useLayout(layout.depends_on(), level + 1);
}
usedLayouts_.push_back(layoutname);
} else {
}
usedLayouts_.push_back(layoutname);
} else {
<< to_utf8(layoutname) << "' does not exist in this class"
<< endl;
}
<< to_utf8(layoutname) << "' does not exist in this class"
<< endl;
}
docstring const & htmlTitle() const { return htmltitle_; }
private:
docstring const & htmlTitle() const { return htmltitle_; }
private:
+ ///
+ void useLayout(docstring const &, int);
///
std::list<docstring> usedLayouts_;
///
///
std::list<docstring> usedLayouts_;
///