Re: should destroying set the refcount to 0?




Maciej Stachowiak <mjs@eazel.com> writes:

> Should bonobo_object_destroy set the refcount to 0? 

Almost certainly not. If you have refcounting on an object
then you can't also have explicit destruction. 

For example: gtk_object_destroy() does not directly affect 
the refcount at all. The only reason it usually results in
a widget being freed is that it remove the widget from its
parent, so the refcount drops to zero.

Either you have to have no _destroy() and just use unref(),
or you have to make _destroy() a "break known references" 
operation.

Regards,
                                        Owen

> Right now, if you destroy the object, it does some cleanup
> (including gtk_signal_disconnects and gtk_object_destroys), but does
> not set the refcount to 0. If the refcount ever does hit zero, that
> cleanup tries to happen again, but fails.




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