#51062 - Warning on finalization of floating object
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list gnome org
- Cc: gnome-2-0-list gnome org
- Subject: #51062 - Warning on finalization of floating object
- Date: 19 Nov 2001 20:47:19 -0500
Just noticed this bug in the list of bugs on the 2.0.0
milestone. Question here is whether code like:
GtkWidget *button = gtk_button_new ();
gtk_widget_unref (button);
Should produce a warning.
This code is wrong because the until you claim ownersip
by calling:
gtk_widget_ref (button); gtk_widget_sink (button);
The last reference on the widget is unowned and you
can _never_ unref a reference you don't own.
We could claim:
- This isn't an API bug because the usage is clearly
wrong and we are always free to add warnings
about incorrect usage.
But that's probably not really fair ... adding this
warning can take functioning (if incorrect) code and
make it spew warnings. People frequently used to use
GtkObject in locations where they didn't want to
use float/sink and instead of just sinking all widgets
immediately, ignored float sink entirely.
Many of these are probably now converted to GObject,
making the point moot (GObject doesn't have float/sink)
but there are probably still some around, and some
people may be manipulating GtkWidgets in this fashion
as well.
So, our options are:
A) Do it now.
B) Do it later before 2.0.0.
C) Don't do it; it's just annoying pedantry.
And I think B) has no advantages ... so it's between
A) and C).
Opinions?
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]