[gtkmm-documentation] Add some info to the custom/custom_container example.



commit 6050bfa7ccc61d7205b2d6e41f93db2ce39ba746
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Sun Mar 3 19:01:06 2013 +0100

    Add some info to the custom/custom_container example.
    
    * examples/book/custom/custom_container/mycontainer.cc: Add some comments and
    commented-out code to the destructor. The code can be necessary, but it
    should not be activated unless a version of gtkmm is used where bug 605728
    has been fixed.

 ChangeLog                                          |    9 +++++++++
 .../book/custom/custom_container/mycontainer.cc    |   13 +++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f70ec98..c0a5e48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2013-03-03  Kjell Ahlstedt <kjell ahlstedt bredband net>
 
+       Add some info to the custom/custom_container example.
+
+       * examples/book/custom/custom_container/mycontainer.cc: Add some comments and
+       commented-out code to the destructor. The code can be necessary, but it
+       should not be activated unless a version of gtkmm is used where bug 605728
+       has been fixed.
+
+2013-03-03  Kjell Ahlstedt <kjell ahlstedt bredband net>
+
        Fix 'make check' with the latest versions of glib and glibmm.
 
        * examples/book/printing/simple/printformoperation.h: Put #include <gtkmm.h>
diff --git a/examples/book/custom/custom_container/mycontainer.cc 
b/examples/book/custom/custom_container/mycontainer.cc
index 85d58cb..10f4390 100644
--- a/examples/book/custom/custom_container/mycontainer.cc
+++ b/examples/book/custom/custom_container/mycontainer.cc
@@ -29,6 +29,19 @@ MyContainer::MyContainer()
 
 MyContainer::~MyContainer()
 {
+/*
+  // These calls to Gtk::Widget::unparent() are necessary if MyContainer is
+  // deleted before its children. But if you use a version of gtkmm where bug
+  // https://bugzilla.gnome.org/show_bug.cgi?id=605728
+  // has not been fixed (gtkmm 3.7.10 or earlier) and the children are deleted
+  // before the container, these calls can make the program crash.
+  // That's because on_remove() is not called, when the children are deleted.
+  if (m_child_one)
+    m_child_one->unparent();
+
+  if (m_child_two)
+    m_child_two->unparent();
+*/
 }
 
 void MyContainer::set_child_widgets(Gtk::Widget& child_one,


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