GNOME Bugzilla – Bug 93334
gtk_container_remove() orphans GtkButtons with gtk_button_new_with_mnemonic()
Last modified: 2011-02-04 16:11:17 UTC
Calling gtk_container_remove() on a button created with gtk_button_new_with_mnemonic() does not reduce the refcount to zero. It leaves an orphaned button, with a refcount of 1. This extra refcount is in gtk_label_set_mnemonic_widget() which refs the parent button. Here's some code to show it. When you uncomment the gtk_button_new_with_label() line instead, the button will be destroyed. I'm not sure whether this is a bug.
Created attachment 11088 [details] test.cc - demonstrates the problem.
Question is whether mnemonics can safely be changed to weak-ref their target widget instead of strong-ref'ing it.
Mon Sep 30 15:45:49 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c (gtk_label_set_mnemonic_widget): Make the reference to the mnemonic widget weak. (#93334, Murray Cumming)