[gtkmm] remove_callback(): When just calling the C callback, because the C++



commit de3fb494d52e4ca52ec8d2ab0ef7ebeb257c9100
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Mar 8 21:17:44 2008 +0000

    remove_callback(): When just calling the C callback, because the C++
    
    2008-03-08  Murray Cumming  <murrayc murrayc com>
    
    * gtk/src/container.ccg: remove_callback(): When just calling the C
    callback, because the C++ object has already been destroyed, don't
    even call the C callback if the GType is exactly GtkContainer. This
    avoids a useless warning from GTK+ about an unimplemented remove()
    default signal handler. This happens when deriving from Gtk::Container -
    remove() really is implemented - it's just that we don't call our own
    implementation when that would be impossible.
    Bug #518002 (Jonathon Jongsma).
    
    svn path=/branches/gtkmm-2-12/; revision=980

 ChangeLog             |   11 +++++++++++
 gtk/src/container.ccg |   11 ++++++++++-
 2 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d8feb55..87bbd59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-03-08  Murray Cumming  <murrayc murrayc com>
+
+	* gtk/src/container.ccg: remove_callback(): When just calling the C
+	callback, because the C++ object has already been destroyed, don't
+	even call the C callback if the GType is exactly GtkContainer. This
+	avoids a useless warning from GTK+ about an unimplemented remove()
+	default signal handler. This happens when deriving from Gtk::Container -
+	remove() really is implemented - it's just that we don't call our own
+	implementation when that would be impossible.
+	Bug #518002 (Jonathon Jongsma).
+
 2009-06-29  Jonathon Jongsma  <jonathon quotidian org>
 
 	* configure.ac:
diff --git a/gtk/src/container.ccg b/gtk/src/container.ccg
index 6ef9968..3684856 100644
--- a/gtk/src/container.ccg
+++ b/gtk/src/container.ccg
@@ -162,11 +162,20 @@ void Container_Class::remove_callback(GtkContainer* self, GtkWidget* p0)
   }
   else
   {
+    //Call the original underlying C function:
+
+    //But don't do this if the GType is just the base GtkContainer 
+    //(the case when deriving from Gtk::Container)
+    //because GtkContainer::remove() then shows a warning that it was not implemented,
+    //and that warning is not useful to us in that case.
+    if(G_OBJECT_TYPE(self) == Gtk::Container::get_type())
+      return;
+
+    //Call the original underlying C function:
     BaseClassType *const base = static_cast<BaseClassType*>(
         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
     );
 
-    //Call the original underlying C function:
     if(base && base->remove)
       (*base->remove)(self, p0);
   }



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