John Darrington <j...@darrington.wattle.id.au> writes: > I'm not convinced that some of the dispose routines that we have are > very reliable at catching reentrancy. > > if (thing->obj != NULL) > g_object_unref (thing->obj); > thing->obj = NULL; > > The problem is that g_object_unref can cause its argument's dispose > routine to run. Which in turn, could unref a reference it holds on > us, and hence run our dispose routine. Since we haven't yet set thing->obj > to NULL, it will call g_object_unref on it again. > > Have I analysed this correctly?
Yes, I think so. If that's a possibility (I think that it really is not in many cases) We either have to do something like this: tmp = thing->obj; thing->obj = NULL; if (tmp) g_object_unref (tmp); or use a "dispose_has_run" variable. The latter makes me nervous because it's possible that some (arguably buggy) dispose routine calls back into us and causes us to allocate something new. _______________________________________________ pspp-dev mailing list pspp-dev@gnu.org https://lists.gnu.org/mailman/listinfo/pspp-dev