GNOME Bugzilla – Bug 88380
Gtk::Notebook: signal_switch_page called after Notebook destroyed
Last modified: 2004-12-22 21:47:04 UTC
I have found a problem where signal_switch_page is being called after Gtk::Main::quit(), it doesn't happen in a C version of the application. This is a problem because you'll get the error: (a.out:24168): Gtk-CRITICAL **: file gtknotebook.c: line 4113 (gtk_notebook_get_nth_page): assertion `GTK_IS_NOTEBOOK (notebook)' failed When calling get_nth_page(), and chances are great that you'll do something in that function which will make the program segfault. A GTK+ and a gtkmm example attached. One should also take notice that the problem doesnt exist if you select the third tab and then quit, it does when you select the first or the second. I can't reproduce it in the GTK+ version.
Created attachment 9907 [details] [review] GTK+ (C) version.
Created attachment 9908 [details] [review] gtkmm (C++) version
Created attachment 9927 [details] notebook.cc: simplified gtkmm version
Simplified version uploaded. _Please_ save me time in future by isolating the problem. By the way, you shouldn't call Gtk::Main::Quit() when using the Gtk::Main::run(window) override. IT calls Gtk::Main::Quit() for you. Just hide() the window and run() will respond accordingly.
2002-07-18 Murray Cumming <murrayc@usa.net> * To fix bug #88380: - Gtk::Container:: Add custom "remove" callback to prevent use of wrap on C objects whose C++ objects have been disconnected. This was generating new, secret, C++ instances. This required a new qdata quark, because we _do_ want to use wrap() on C objects whose C++ instance has not _yet_ been created. I think this is just a Container::remove thing - The GTK+ people obviously don't test the full behaviour with unmanaged widgets. - tools/signal.m4: Don't call the Slot if the C object's C++ wrapper has been disconnected from the C object.