Good questions and remarks. As for the warnings, I've already filed a bug sometime ago but noone has done anything about it. The bug-->http://bugzilla.gnome.org/show_bug.cgi?id=606903 Date: Sun, 14 Feb 2010 11:26:42 +0100 Subject: custom widget example from the gtkmm book is out of date From: bastien dallapiazza gmail com To: gtkmm-list gnome org Hi, I the custom widget example from the gtkmm book seems to be out of date as it generates the following errors when ending: (test:2683): Gdk-WARNING **: losing last reference to undestroyed window (test:2683): Gdk-CRITICAL **: gdk_window_hide: assertion `GDK_IS_WINDOW (window)' failed (test:2683): Gdk-CRITICAL **: gdk_window_set_user_data: assertion `GDK_IS_WINDOW (window)' failed (test:2683): Gdk-CRITICAL **: _gdk_window_destroy_hierarchy: assertion `GDK_IS_WINDOW (window)' failed (test:2683): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed This has to do with the Gdk::Window created in the mywidget::on_realize method. It is not properly destroyed at the end of the example program. I've been playing with gtkmm for about a year now, and I found the way to create new widgets extremely confusing and I found nowhere a proper documentation about that (except the above example): The reason for having two "constructor methods" called successively, the actual constructor and the on_realize method (and on the other hand destructor and on_unrealize for destruction) is unclear. I understand it has to do with the low-level Gdk resources, but for instance in this example, how is the Gdk::Window destroyed? Does the programmer have the responsability to destroy it or should he bother only about the Gtk widgets? Cheers! Hotmail: Αξιόπιστο email με ισχυρή προστασία ενάντια στην ανεπιθύμητη αλληλογραφία. Εγγραφείτε τώρα. |