On 22 Mar 2013 at 14:33, Alex Leach wrote: > So, in Environment's destructor, which I thought was a no-op, FastMutex's > destructor is also being called. Now, that's a bit of a bummer. As far as > I can tell (I'm still very new to C++; coming from Python), unlike how I > hacked the initialiser list, I can't do any work either side of the > chained base class destructor calls.
Separate C++ objects from their python wrappers. Have C++ objects held by shared_ptr. Have a custom deleter on shared_ptr invoke a virtual int_PythonIsAboutToDelete() function before it actually calls delete. You see as soon as destruction begins, all virtual functions cease to work, so you need a predestructor stage. Do your pre destruction cleanup like destroying mutexs in that virtual function. Or indeed anything which can throw exceptions, because destructors are (soon to be) noexcept. Hope that helps, Niall -- Any opinions or advice expressed here do NOT reflect those of my employer BlackBerry Inc. Work Portfolio: http://careers.stackoverflow.com/nialldouglas/
SMime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig