[C++-sig] Re: Pyste feature: class member deletion order solution

Niall Douglas s_sourceforge at nedprod.com
Mon Nov 10 01:45:14 CET 2003


On 9 Nov 2003 at 14:19, David Abrahams wrote:

> > I was thinking that the obvious solution is for representations of
> > C++ objects to be able to hold a boost::python::handle<> of their
> > parent, thus ensuring that the parent stays alive as long as its
> > children. 
> 
> Won't help.  You'll have a reference cycle.  that have __del__()
> methods and are part of a reference cycle cause the entire reference
> cycle to be uncollectable, which will prevent the C++ object from
> being destroyed.

I can't see how that would happen. The bottom-most children (who 
don't have any extra things holding a reference to them) when deleted 
decrement the reference count of their parents. If a parent has no 
other thing using it, it too gets deleted.

Cheers,
Niall




-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 208 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20031110/bb51448e/attachment.pgp>


More information about the Cplusplus-sig mailing list