Ellery Newcomer wrote: > Hello all. > > I have been trying to wrap a third party C++ library with boost::python > (first time using boost::python!), and on a very simple example I seem to > be getting double free segfaults, so I am here soliciting advice. Does > anything stand out? > > In gdb, I can't seem to catch it calling any particular destructor more > than once. > > In pure c++, the class I am wrapping does not exhibit any such segfaults on > simple usage, eg > { > CMOOSApp *app = new CMOOSApp(); > delete app; > } > > and other classes in the library do not exhibit such segfaults when I wrap > them. > > c++: > > #include <boost/python.hpp> > #include <MOOS/libMOOS/MOOSLib.h> > > using namespace boost::python; > > BOOST_PYTHON_MODULE(MOOSCore) > { > class_<CMOOSApp, boost::noncopyable>("MOOSApp"); > } > > python: > > import MOOSCore > > thing = MOOSCore.MOOSApp() > > results: > > $ python test.py > *** glibc detected *** python: double free or corruption (out): > 0x0000000000f92b50 *** > ======= Backtrace: ========= > /lib64/libc.so.6[0x3b8a4760e6] > /lib64/libc.so.6[0x3b8a478c13] > /usr/lib64/libboost_python.so.5(_ZN5boost6python15instance_holder10deallocateEP7_objectPv+0x15) [0x7f15ee57a0b5] > /usr/lib64/libboost_python.so.5(+0x2a394)[0x7f15ee57a394] > /usr/lib64/libpython2.6.so.1.0[0x3b9de9a715] > /usr/lib64/libpython2.6.so.1.0[0x3b9de78287] > /usr/lib64/libpython2.6.so.1.0(PyDict_SetItem+0xa7)[0x3b9de7acf7] > /usr/lib64/libpython2.6.so.1.0(_PyModule_Clear+0x16d)[0x3b9de7c66d] > /usr/lib64/libpython2.6.so.1.0(PyImport_Cleanup+0x18f)[0x3b9dee987f] > /usr/lib64/libpython2.6.so.1.0(Py_Finalize+0x11b)[0x3b9def28ab] > /usr/lib64/libpython2.6.so.1.0(Py_Main+0x596)[0x3b9deff2d6] > /lib64/libc.so.6(__libc_start_main+0xfd)[0x3b8a41ecdd] > python[0x400649] > > > the class CMOOSApp is defined here: > > https://oceanai.mit.edu/svn/moos-ivp-aro/releases/moos-ivp-13.5/MOOS_V10Beta_rc2/MOOSCore/Core/libMOOS/App/include/MOOS/libMOOS/App/MOOSApp.h > > my complete code can be found here on the off chance someone wants to > tinker with it: > > https://bitbucket.org/ariovistus/moos-python
These issues can usually be traced using valgrind _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig