GNOME Bugzilla – Bug 736307
GtkStackSwitcher doesn't like removing children from stack
Last modified: 2014-09-12 01:12:25 UTC
Created attachment 285708 [details] sample code GtkStackSwitcher doesn't like removing children from stack Compile the attached sample. Run it. Close the window. I get warnings: (sample:21591): Gtk-WARNING **: gtkstack.c:556: invalid child property id 2 for "title" of type 'GParamString' in 'GtkStack' (sample:21591): Gtk-WARNING **: gtkstack.c:556: invalid child property id 3 for "icon-name" of type 'GParamString' in 'GtkStack' (sample:21591): Gtk-CRITICAL **: gtk_widget_set_valign: assertion 'GTK_IS_WIDGET (widget)' failed (sample:21591): Gtk-CRITICAL **: gtk_bin_get_child: assertion 'GTK_IS_BIN (bin)' failed (sample:21591): Gtk-CRITICAL **: gtk_widget_get_style_context: assertion 'GTK_IS_WIDGET (widget)' failed (sample:21591): Gtk-CRITICAL **: gtk_widget_set_visible: assertion 'GTK_IS_WIDGET (widget)' failed (sample:21591): Gtk-CRITICAL **: gtk_widget_set_size_request: assertion 'GTK_IS_WIDGET (widget)' failed (sample:21591): Gtk-WARNING **: gtkstack.c:556: invalid child property id 5 for "needs-attention" of type 'GParamBoolean' in 'GtkStack' (sample:21591): Gtk-CRITICAL **: gtk_widget_get_style_context: assertion 'GTK_IS_WIDGET (widget)' failed (sample:21591): Gtk-CRITICAL **: gtk_style_context_remove_class: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed (sample:21591): Gtk-WARNING **: gtkstack.c:556: invalid child property id 2 for "title" of type 'GParamString' in 'GtkStack' (sample:21591): Gtk-WARNING **: gtkstack.c:556: invalid child property id 3 for "icon-name" of type 'GParamString' in 'GtkStack' (sample:21591): Gtk-CRITICAL **: gtk_widget_set_valign: assertion 'GTK_IS_WIDGET (widget)' failed (sample:21591): Gtk-CRITICAL **: gtk_bin_get_child: assertion 'GTK_IS_BIN (bin)' failed (sample:21591): Gtk-CRITICAL **: gtk_widget_get_style_context: assertion 'GTK_IS_WIDGET (widget)' failed (sample:21591): Gtk-CRITICAL **: gtk_widget_set_visible: assertion 'GTK_IS_WIDGET (widget)' failed (sample:21591): Gtk-CRITICAL **: gtk_widget_set_size_request: assertion 'GTK_IS_WIDGET (widget)' failed (sample:21591): Gtk-WARNING **: gtkstack.c:556: invalid child property id 5 for "needs-attention" of type 'GParamBoolean' in 'GtkStack' (sample:21591): Gtk-CRITICAL **: gtk_widget_get_style_context: assertion 'GTK_IS_WIDGET (widget)' failed (sample:21591): Gtk-CRITICAL **: gtk_style_context_remove_class: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed If I do that from a larger Gtkmm program (in Gtkmm), I actually get crashes.... almost automatically. Expect: Removing the children of a stack should be fine and the switcher should deal with it properly. Note: I only have Gtk+ 3.12.2
I can reproduce that with master.
That would be commit 2e88ae8ad99a07e5adf1264dead14f71d978b461 Thanks !!!!
Created attachment 285883 [details] sample code 2 Here's a slightly modified test case, showing there are still problems with GtkStackSwitcher. I think the problem is that clear_switcher() does not undo everything that populate_switcher() has done. When gtk_stack_switcher_set_stack() is called a second time (in the test case it's called from gtk_stack_switcher_dispose()), signal handlers are not disconnected from the children of the previously connected GtkStack. This problem was first noticed in the C++ test case in the gtkmm bug 736339.
I would have preferred a new bug for that - seems a separate issue. Thanks for the testcase, anyway.
This is 3d7f0590870d76b61d1645fef6eb099445b11073 Thanks again.