GtkLabel strong refs the mnemonic widget
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list gnome org
- Subject: GtkLabel strong refs the mnemonic widget
- Date: Fri, 27 Sep 2002 14:48:05 -0400 (EDT)
[ Bug reference: http://bugzilla.gnome.org/show_bug.cgi?id=93334 ]
Another compatibility question. Right now:
GtkWidget *button = gtk_button_new_with_mnemonic ("_Push Me");
g_object_ref (button);
gtk_object_sink (GTK_OBJECT (button);
gtk_container_add (container, button);
gtk_container_remove (container, button);
g_object_unref (button);
Leaks the button and contained label. This is because
gtk_label_set_mnemonic_widget() makes a strong reference
on the label, so you get a reference loop between the
button and the label.
The obvious fix for this would be to make the reference
a weak reference instead. That, however, is strictly
speaking an incompatible change, because code like:
GtkLabel *label = gtk_label_new ("Foo');
GtkWidget *entry = gtk_entry_new ();
g_object_ref (entry);
gtk_object_sink (GTK_OBJECT (entry));
gtk_label_set_mnemonic_widget (label, entry);
g_object_unref (entry);
[...]
entry = g_object_ref (gtk_label_get_mnemonic_widget (label));
Woudl no longer work. I think that this is "acceptable breakage -
I really doubt people use the mnemonic widget property as
the only reference to a widget, but one can always be
suprised...
As always, I'd be interested to here people's opinions on
the matter.
Thanks,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]