Re: Refcounting craziness



on 1/26/01 10:55 AM, Owen Taylor at otaylor redhat com wrote:

> =================
> static void
> bonobo_embeddable_destroy (GtkObject *object)
> {
>   BonoboEmbeddable *embeddable = BONOBO_EMBEDDABLE (object);
> 
>   /*
>    * Destroy all our views.
>    */
>   while (embeddable->priv->views) {
>     BonoboView *view = BONOBO_VIEW (embeddable->priv->views->data);
>     bonobo_object_unref (BONOBO_OBJECT (view));
>   }
> =================
> 
> So, for each view, it unrefs it until the refcount goes to zero
> and the view is destroyed and removed from embeddable->priv->views
> by a ::destroy callback.

A quick observation, in case this helps resolve the issue:

Back when bonobo_object_destroy existed, a trivial fix for this would have
been to call bonobo_object_destroy on each view before calling
bonobo_object_unref.

A fix without an explicit destroy call would be to disconnect the destroy
handler and remove the view from the views list before unref'ing it. But
that might cause some kind of problem if a view has some problem existing
once its embeddable is gone -- this is at the heart of why "destroy" is used
by GtkWidget.

    -- Darin





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