Re: [g-a-devel]Gail Crashes

Hi Marc,

	I'm slightly confused by your mail:

On Sat, 2002-03-30 at 19:44, Marc Mulcahy wrote:
> The problem here is that the GtkWidget pointer we hold still has a 
> reference in it, but the actual GtkWidget structure it points to is 
> gone.  So, when we call gtk_widget_get_accessible, things go wrong.

	You can't hold a reference to the GtkWidget and have the structure
destroyed - that is a referencing bug. The GtkWidget pointer will remain
valid as long as you hold a g_object_ref on it - assuming that other
people arn't doing silly things with the reference count [ NB. remember
that dispose can be called multiple times, don't unconditionally unref
things there or in a 'destroy' handler ].

> If we ref the widget, is that enough?


>  WE don't want to prevent the widget 
> from being destroyed, we just want to be notified when it is destroyed.

	Destruction - including unrealizing, freeing of X (& other) resources
is de-coupled from the widget's lifecycle. Furthermore all methods
should continue to function (ie. not crash) on a disposed ( / destroyed
) widget.

> Maybe weakrefs are the answer...

	Not really. You want to loose the ref on the accessible when the widget
is destroyed - it can never be resurrected, and to disassociate the
accessible with the widget. The case where an accessible lives longer
than the widget it's associated with has to work - since there is no
reason a remote at will release a ref properly ( or at all ) on an
Accessible, and will most likely continue to invoke methods on it.

	So - in short; I believe the current scheme should work - the only
problem must be either that a) you're not holding a ref properly on
whatever you're caching, or b) somewhere else there is a ref leak / over
un-reffing problem.



 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot

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