[C++-sig] Problems with functions taking string arguments on Windows

greg Landrum greglandrum at mindspring.com
Mon Jun 2 22:25:08 CEST 2003


At 11:44 AM 6/2/2003, greg Landrum wrote:

>[Boost 1.30, Win2K, MSVC v6]
>
>Additional information:
>Just to verify that this is not due to my suggested changes in 
>builtin_converters.cpp::string_rvalue_from_python(), I switched that code 
>back to its previous form (without the PyString_Size argument to the 
>std::string constructor); this does not change the behavior I'm observing 
>(i.e. it still crashes ever time).

I've managed to figure out a bit more of what's going on.  The conversion 
from PyObject* -> std::string is working just fine. The crash is happening 
when ~rvalue_from_python_data() calls 
python::detail::destroy_referent().  This ends up (via the 
type_traits::value_destroyer stuff) calling the destructor of the 
std::string which was built for the argument.  I'm guessing that this is 
the problem.


I've attached relevant bits of the stack trace, if that's at all helpful.

-greg


-------------- next part --------------
_CrtIsValidHeapPointer(const void * 0x00770460) line 1697
_free_dbg_lk(void * 0x00770460, int 1) line 1044 + 9 bytes
_free_dbg(void * 0x00770460, int 1) line 1001 + 13 bytes
free(void * 0x00770460) line 956 + 11 bytes
operator delete(void * 0x00770460) line 7 + 10 bytes
std::allocator<char>::deallocate(void * 0x00770460, unsigned int 33) line 64 + 16 bytes
std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy(unsigned char 1) line 592
std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> >() line 59 + 17 bytes
boost::python::detail::value_destroyer<0,0>::execute(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > * 0x0012f9f0 {0x00770461 "foo"}) line 22 + 11 bytes
boost::python::detail::destroy_referent_impl(void * 0x0012f9f0, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & (void)* 0x00000000) line 72 + 9 bytes
boost::python::detail::destroy_referent(void * 0x0012f9f0, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & (void)* 0x00000000) line 78 + 11 bytes
boost::python::converter::rvalue_from_python_data<std::basic_string<char,std::char_traits<char>,std::allocator<char> > &>::~rvalue_from_python_data<std::basic_string<char,std::char_traits<char>,std::allocator<char> > &>() line 136 + 14 bytes
boost::python::converter::arg_rvalue_from_python<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::~arg_rvalue_from_python<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >() + 22 bytes
boost::python::arg_from_python<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::~arg_from_python<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >() + 22 bytes
boost::python::detail::nullary<boost::python::arg_from_python<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::~nullary<boost::python::arg_from_python<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >() + 22 bytes
boost::python::detail::caller_arity<1>::impl<int (__cdecl*)(std::basic_string<char,std::char_traits<char>,std::allocator<char> >),boost::python::detail::args_from_python,boost::python::default_call_policies,boost::mpl::list2<int,std::basic_string<73526af8(_object * 0x0077c0c8, _object * 0x00000000) line 164 + 42 bytes
boost::detail::function::function_obj_invoker2<boost::python::detail::caller<int (__cdecl*)(std::basic_string<char,std::char_traits<char>,std::allocator<char> >),boost::python::detail::args_from_python,boost::python::default_call_policies,boost::m3fc2b75d(boost::detail::function::any_pointer {...}, _object * 0x0077c0c8, _object * 0x00000000) line 118



More information about the Cplusplus-sig mailing list