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 93334 - gtk_container_remove() orphans GtkButtons with gtk_button_new_with_mnemonic()
gtk_container_remove() orphans GtkButtons with gtk_button_new_with_mnemonic()
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.0.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2002-09-15 15:40 UTC by Murray Cumming
Modified: 2011-02-04 16:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test.cc - demonstrates the problem. (1.11 KB, text/plain)
2002-09-15 15:42 UTC, Murray Cumming
Details

Description Murray Cumming 2002-09-15 15:40: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.
Comment 1 Murray Cumming 2002-09-15 15:42:05 UTC
Created attachment 11088 [details]
test.cc - demonstrates the problem.
Comment 2 Owen Taylor 2002-09-26 21:32:47 UTC
Question is whether mnemonics can safely be changed to weak-ref
their target widget instead of strong-ref'ing it.
Comment 3 Owen Taylor 2002-09-30 20:02:59 UTC
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)