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



commit a86aeebc3e75378756fbfd9796e81056ac840961
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 |   13 +++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 145d6d3..70fd8ed 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-04-18  Daniel Elstner  <danielk openismus com>
 
 	* docs/reference/images/stock: Add these stock images to the repository for
diff --git a/gtk/src/container.ccg b/gtk/src/container.ccg
index 9c2b08b..4fa7a70 100644
--- a/gtk/src/container.ccg
+++ b/gtk/src/container.ccg
@@ -1,5 +1,5 @@
 // -*- c++ -*-
-/* $Id$ */
+/* $Id: container.ccg,v 1.12 2006/07/19 16:58:50 murrayc Exp $ */
 
 /* Copyright 1998-2002 The gtkmm Development Team
  *
@@ -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]