Re: GtkWindow destroy problem



Tim Janik <timj gtk org> writes: 
> not in GtkObject, since this is valid code (apart from GTK_TYPE_OBEJCT
> being abstract):
> o = g_object_new (GTK_TYPE_OBJECT, NULL);
> gtk_object_unref (o);
> the object will be correctly destroyed but never had someone resetting its
> floating flag (e.g. for a widget that means it got never added to a container).

Basically I don't think that code should be valid, because it involves
removing a reference you don't own and relying on implicit knowledge
that no one else will do so. 

The actual code people write will always be more complicated and the
unref() after doing anything more complicated (for example, invoking a
function on the object) is definitely wrong, because it is legitimate
for anyone to sink an object, and you don't know if they have.

Plus allowing this code does not add any useful feature; because you
could always write gtk_object_sink() instead of the unref().

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]