On 27 Apr 2004, at 13:01, Orton, Yves wrote: [snip]
No but I can describe one that would. Imagine a binary tree. We store each
node using weakrefs in the structure you describe. Now I search and find an
internal node of the tree. The root of the tree falls out of scope,
essentially "stripping" the tree of all of its relatives. Now the hash
contains a zillion refs to non existant objects. Access one of those and
POOF!
[snip]

Erm. I don't think so. If the thing a weakref points to is collected you get a pointer to undef. To quote from the docs:

REF will be turned into a weak reference. This means that it not hold a reference count on the object it references. Also the reference count on that object reaches zero, REF will be set undef.

If you're getting something that can cause a segfault then something's wrong somewhere surely.

Adrian



Reply via email to