Hi To solve my previous problem I'm trying implement a class witch store the PyObject pointer. using this solution: http://www.boost.org/doc/libs/1_36_0/libs/python/doc/v2/faq.html#xref
then during the destructor of my wrapper class I want destroy the PyObjects of my children with: object_wrapper::~object_wrapper() { foreach(object child, this->children()) python::detail::dealloc(child->py_self;); } but after my function I get a core dump in this boost call: * boost::python::objects::find_instance_impl(_object*, boost::python::type_info, bool) (in /usr/lib/libboost_python-py25.so.1.35.0) I think there is a way to communicate to boost to remove my objet form your object list. How I can do this? This is the correct way?? Have a best boost way to do this?? BR -- Renato Araujo Oliveira Filho On Mon, Nov 3, 2008 at 4:15 PM, Renato Araujo <[EMAIL PROTECTED]> wrote: > Sorry my last message I sent incomplete :) > > > I will try again. > > First I have a c++ class like this: > > struct object > { > object(object *parent=0) // if parent !=NULL append this at > parent children list > ~object() //Destroy all children > }; > > > Is possible implement this using "python::with_custodian_and_ward_postcall"? > I tried some like that: > > qclass_<object_wrapper, boost::noncopyable > ("object", python::init<> ()) > //here i put self will be the ward and arg 2 (parent) will be the > custodian > //the lifetime of the self will be dependent on the lifetime of the parent > > .def(python::init<object*>()[python::with_custodian_and_ward_postcall<2,1>()]) > > > But in my python code I tried some like that: > > o = object() > o2 = object(o) > > del o > > and this produce this exception during the del operation: > *** glibc detected *** python: free(): invalid pointer: 0x09c89970 *** > -- Renato Araujo Oliveira Filho _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig