[gtkmm-documentation/gtkmm-3-22] Clarify: ColumnRecords can be static *singletons*



commit 8f27a2a105bb326564573523ab3033ef3cdd789c
Author: Daniel Boles <dboles src gmail com>
Date:   Wed Nov 22 21:56:38 2017 +0000

    Clarify: ColumnRecords can be static *singletons*
    
    Sharing these between models is highly desirable as it can avoid a lot
    of work and waste. So, take the para warning about not making static
    ColumnRecords, and reword it to explain why you probably wanted a static
    one and what the real solution is.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792482

 docs/tutorial/C/index-in.docbook |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/docs/tutorial/C/index-in.docbook b/docs/tutorial/C/index-in.docbook
index f6ab828..da0f4a6 100644
--- a/docs/tutorial/C/index-in.docbook
+++ b/docs/tutorial/C/index-in.docbook
@@ -2403,8 +2403,15 @@ like so:
 </para>
 <programlisting>Glib::RefPtr&lt;Gtk::ListStore&gt; refListStore =
     Gtk::ListStore::create(m_Columns);</programlisting>
-<para>Note that the instance (such as m_Columns here) should usually not be static, because it often needs 
to be instantiated after
-glibmm has been instantiated.</para>
+<para>
+As a <classname>TreeModelColumnRecord</classname> describes structure, not data,
+it can be shared among multiple models, and this is preferable for efficiency.
+However, the instance (such as <varname>m_Columns</varname> here) should usually
+not be static, because it often needs to be instantiated after
+<application>glibmm</application> has been ininitialized. The best solution is
+to make it a lazily instantiated singleton, so that it will be constructed
+on-demand, whenever the first model accesses it.
+</para>
 </sect2>
 
 <sect2 id="treeview-adding-rows">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]