
Tanguy Fautre <tanguy.fautre@spaceapplications.com> writes:
And please bring your Boost.Python questions to the C++-sig <http://boost.org/more/mailing_lists.htm#cplussig>.
After doing a minimal example reproducing this error, I think I found the problem.
According to the C++ Programming Language (3rd ed), Section 14.7: "It is implementation-defined whether destructors are invoked when a program is terminated because of an uncaught exception.".
Yes.
That, I did not know. I thought destructor were always called.
GCC 4.x and Visual C++ 2005 are indeed calling std::terminate without calling the destructors. Except... Except when debugging with VC++ 2005. When debugging, you have the choice to continue after a uncaught exception is thrown as if nothing happened. This effectively leads to a segfault as described as above.
I think changing the semantics of "throw x" from "unwind the stack and maybe terminate" to "continue as though nothing has happened" seems like it could break any program.
So it's not a problem with my application nor Boost.Python. Just my misunderstanding of uncaught exceptions and of Visual C++.
Sorry I bothered you with this false alert.
'S ok. -- Dave Abrahams Boost Consulting www.boost-consulting.com