GNOME Bugzilla – Bug 601409
action area presence modifies notebook behaviour
Last modified: 2009-11-28 17:08:16 UTC
Steps to reproduce: 0) Start gnome-terminal 1) Observe no critical warnings on console; quit g-t 2) Modify gnome-terminal/src/terminal-window.c:terminal_window_init() by adding the following line directly after the "priv->notebook = gtk_notebook_new ();" line: gtk_notebook_set_action_widget (GTK_NOTEBOOK (priv->notebook), gtk_hbox_new (FALSE, 6), GTK_PACK_START); 3) Compile, start g-t 4) Observe critical warning on console, once for each new tab created: (gnome-terminal:10359): GLib-GObject-CRITICAL **: g_object_get_data: assertion `G_IS_OBJECT (object)' failed (gdb) where
+ Trace 218984
Analysis: gtk_container_get_chilren() docs say "Returns the container's non-internal children. [...]" However, with the patch from bug 116650, the action widgets are included in this list when getting the notebook children. IMHO these widgets are internal children like the tab label widgets, and should therefore not be included. This certainly breaks g-t, and probably any other gnome MDI app (epiphany, gedit, ...).
Created attachment 147380 [details] [review] patch
I would say the boundary between 'internal' and 'regular' children is at least somewhat fuzzy. Really, if the application provides a tab label widget, that is not an 'internal' widget. But if the app just provides a string, then the label widget is arguably internal. Also, it is somewhat hard to argue that MDI apps would be broken by this when they have to explicitly use the new api to get into the problematic situation in the first place. Anyway, we should consider treating action widgets as internal.
(In reply to comment #2) > I would say the boundary between 'internal' and 'regular' children is at least > somewhat fuzzy. Really, if the application provides a tab label widget, that is > not an 'internal' widget. But if the app just provides a string, then the label > widget is arguably internal. The current notebook makes no distinction there. gtk_container_get_children() gets exactly the list of tab content widgets. Which IMO is the right behaviour. > Also, it is somewhat hard to argue that MDI apps would be broken by this when > they have to explicitly use the new api to get into the problematic situation > in the first place. That's not exactly the case. E.g. when the app itself doesn't use that API, but an extension/plugin adds some action widget into the notebook (e.g. an epiphany extension adding a NewTab button). Then the app breaks.
I'm sure extensions have more than enough rope to break epiphany easily in other ways...
Comment on attachment 147380 [details] [review] patch Ok, lets go with this for now. Might be worth adding a line to the docs somewhere about it.
Thanks! Committed to master. I added this line to the docs for gtk_notebook_set_action_widget: * Note that action widgets are "internal" children of the notebook and thus * not included in the list returned from gtk_container_foreach().