]> git.lyx.org Git - features.git/commitdiff
Fix problem reported by Kornel in this thread:
authorRichard Heck <rgheck@lyx.org>
Sun, 27 Mar 2016 20:54:46 +0000 (16:54 -0400)
committerRichard Heck <rgheck@lyx.org>
Sun, 27 Mar 2016 20:56:17 +0000 (16:56 -0400)
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

src/TextClass.cpp
src/TextClass.h

index c6f3ee0daf41b5fd55cf6ca97d0b6d7e7136a191..e71fed068814bb7a548b36ada63d46c932bdbef8 100644 (file)
@@ -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_;
 }
 
index a6ffed902ae0c1aec9f10c2e8433e07e18a70608..88f93036e029ae4b9c4dd959cf5d7e74cab074fb 100644 (file)
@@ -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_;
 };