After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 88380 - Gtk::Notebook: signal_switch_page called after Notebook destroyed
Gtk::Notebook: signal_switch_page called after Notebook destroyed
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
2.0
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2002-07-16 18:58 UTC by Morten Brix Pedersen
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GTK+ (C) version. (2.28 KB, patch)
2002-07-16 18:58 UTC, Morten Brix Pedersen
none Details | Review
gtkmm (C++) version (1.68 KB, patch)
2002-07-16 18:59 UTC, Morten Brix Pedersen
none Details | Review
notebook.cc: simplified gtkmm version (1.06 KB, text/plain)
2002-07-17 12:49 UTC, Murray Cumming
  Details

Description Morten Brix Pedersen 2002-07-16 18:58:12 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.
Comment 1 Morten Brix Pedersen 2002-07-16 18:58:55 UTC
Created attachment 9907 [details] [review]
GTK+ (C) version.
Comment 2 Morten Brix Pedersen 2002-07-16 18:59:25 UTC
Created attachment 9908 [details] [review]
gtkmm (C++) version
Comment 3 Murray Cumming 2002-07-17 12:49:00 UTC
Created attachment 9927 [details]
notebook.cc: simplified gtkmm version
Comment 4 Murray Cumming 2002-07-17 12:51:22 UTC
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.
Comment 5 Murray Cumming 2002-07-18 21:29:38 UTC
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.