Re: weakref semantics



On Thu, 17 Jan 2008, Yevgen Muntyan wrote:

Alexander Larsson wrote:
On Thu, 2008-01-17 at 07:50 -0600, Yevgen Muntyan wrote:

A GWeakNotify <cid:part1.03020602.08010607@tamu.edu> function can be added to an object as a
callback that gets triggered when the object is finalized.
Since the object is already being finalized when the
GWeakNotify <cid:part1.03020602.08010607@tamu.edu> is called, there's not much you could do with
the object, apart from e.g. using its adress as hash-index or the like.

I have never seen the docs quoted in the original mail,
and what docs say about g_object_weak_ref() implies
that weak ref callback is called 1) exactly once; 2) after
the object is finalized (and so I got some code which
supposes that the callback is called exactly once). So
what is the truth? Possibly more than once, and before
finalize()?


Only once (per time you register it),

But it contradicts with "As such, each weak ref can be invoked more
than once upon object finalization (since dispose can run more than
once during object finalization)."

that's bogus. each installed weakref can only ever be called once, just
like GData destroy handlers.
also, dispose is never called *during* finalization, the docs should
say "dispose can run more than once before object finalization".

But is consistent with what John
said.

So, two docs bugs?

yep.

Best regards,
Yevgen

---
ciaoTJ


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