Re: bonobo_control_finalize() unref/destroy plug (was Re: GTK 1.2 - gtk_object_unref() trouble)

on 9/27/00 12:01 PM, Martin Baulig at martin home-of-linux org wrote:

> Hmm, still a bit confused - when they unref themselves when they're destroyed,
> is it still necessary to gtk_object_destroy() them or will this also happen
> automatically (I mean, if for some strange reason the refcount of the plug
> happens to be larger than 1 in bonobo_control_finalize()) ?

To get rid of a plug, you must gtk_object_destroy it. If you
gtk_object_unref it, without gtk_object_ref'ing it first you are doing
something illegal -- you are doing an unref of a reference you don't hold.
Since the object holds a reference to itself, no amount of gtk_object_unref
will make it go away.

If you call gtk_object_destroy and someone else has done a gtk_object_ref,
the object will be destroyed, but not finalized, until the code that did the
ref does a gtk_object_unref. When it does, the object will be finalized. The
reference that the object held on itself because it's a top level container
is gone (went away at destroy time).

> Btw. here's the full patch:

Patch looks good to me.

    -- Darin

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