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 709049 - gtk_widget_destroy() on a GtkHeaderBar tries to gtk_container_remove() if from its GtkWindow
gtk_widget_destroy() on a GtkHeaderBar tries to gtk_container_remove() if fro...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 708866
 
 
Reported: 2013-09-29 20:35 UTC by Murray Cumming
Modified: 2013-10-06 03:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test_headerbar.c (1.19 KB, text/x-csrc)
2013-10-01 08:56 UTC, Murray Cumming
  Details
test_headerbar.c (1.14 KB, text/plain)
2013-10-01 08:59 UTC, Murray Cumming
  Details
patch: GtkWindow: Override gtk_container_remove () (2.06 KB, patch)
2013-10-03 17:10 UTC, Kjell Ahlstedt
committed Details | Review

Description Murray Cumming 2013-09-29 20:35:02 UTC
gtk_window_set_titlebar() calls gtk_widget_set_parent() on the titlbar widget. But, of course, it's not the Window's (GtkBin's) child. This seems to be the first widget in GTK+ that can't have
  gtk_container_remove(gtk_widget_get_parent(widget), widget);
called without a warning.

This is something that gtkmm has expected for many years. We can hopefully add an extra check to avoid the warning, but it seems a bit odd.
Comment 1 Matthias Clasen 2013-09-30 14:29:47 UTC
It is not the bin child - it is an internal child, more or less. Admittedly, we muddy the waters a bit by letting you provide your own widget for it. But I don't think it is too unexpected that you can't remove it with gtk_container_remove if you can't add it with gtk_container_add.
Comment 2 Murray Cumming 2013-10-01 08:56:55 UTC
Created attachment 256165 [details]
test_headerbar.c
Comment 3 Murray Cumming 2013-10-01 08:58:00 UTC
Yes, sorry, of course there are lots of internal widgets, and we shouldn't expect to be able to remove them. But this widget is "added' by gtk_window_set_titlebar(). It's not unreasonable to think of that as a widget-adding function such as gtk_box_pack().

However, I've since figured out that it isn't gtkmm at all that's trying to remove this widget. It's GTK+ trying to remove it when the GtkHeaderBar is gtk_widget_destroy()ed, which is somthing that gtkmm calls. This test_headerbar.c test shows that, when you click on the button. I guess that this should not cause a warning.
Comment 4 Murray Cumming 2013-10-01 08:59:30 UTC
Created attachment 256166 [details]
test_headerbar.c
Comment 5 Kjell Ahlstedt 2013-10-03 17:10:44 UTC
Created attachment 256405 [details] [review]
patch: GtkWindow: Override gtk_container_remove ()

Proposed patch.