From: Richard Heck Date: Sun, 27 Mar 2016 20:54:46 +0000 (-0400) Subject: Fix problem reported by Kornel in this thread: X-Git-Tag: 2.2.0rc1~59 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=23f6c1c9621a012c1f91c5e26d1e8d80d717841f;p=features.git Fix problem reported by Kornel in this thread: https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg193248.html The static InsetLayout could be initialized before its members were, as JMarc realized here: https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg193293.html --- diff --git a/src/TextClass.cpp b/src/TextClass.cpp index c6f3ee0daf..e71fed0688 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -129,9 +129,6 @@ string translateReadType(TextClass::ReadType rt) docstring const TextClass::plain_layout_ = from_ascii(N_("Plain Layout")); -InsetLayout DocumentClass::plain_insetlayout_; - - ///////////////////////////////////////////////////////////////////////// // // TextClass @@ -1509,6 +1506,12 @@ InsetLayout const & DocumentClass::insetLayout(docstring const & name) const n = n.substr(0, i); } // Layout "name" not found. + return plainInsetLayout(); +} + + +InsetLayout const & DocumentClass::plainInsetLayout() { + static InsetLayout plain_insetlayout_; return plain_insetlayout_; } diff --git a/src/TextClass.h b/src/TextClass.h index a6ffed902a..88f93036e0 100644 --- a/src/TextClass.h +++ b/src/TextClass.h @@ -402,7 +402,7 @@ public: /// happen). -- Idea JMarc, comment MV InsetLayout const & insetLayout(docstring const & name) const; /// a plain inset layout for use as a default - static InsetLayout const & plainInsetLayout() { return plain_insetlayout_; } + static InsetLayout const & plainInsetLayout(); /// add a new layout \c name if it does not exist in layoutlist_ /// \return whether we had to add one. bool addLayoutIfNeeded(docstring const & name) const; @@ -498,8 +498,6 @@ private: friend DocumentClassPtr getDocumentClass(LayoutFile const &, LayoutModuleList const &, bool const clone); - /// - static InsetLayout plain_insetlayout_; };