Re: #51062 - Warning on finalization of floating object



On 19Nov2001 08:47PM (-0500), Owen Taylor wrote:
> 
> 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.

I think it is fair to not consider this an API bug for reasons
stated. Particularly since it only spews warnings, rather than making
existing code crash or fail to compile.

But better to do it sooner rather than later, perhaps once all the API
bugs are done.

Regards,

Maciej



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