collisiontraverser crash in latest cvs

CollisionTraverser myTraverser = CollisionTraverser("ctraverser");

This gives me a crash, with the current CVS version, the crash is actually in a memcpy call used by the constructor of basic_string. Just wondering if it’s a known issue. It’s built with --optimize 1.

call stack:

 	msvcr90d.dll!memcpy(unsigned char * dst=0x00cda7b8, unsigned char * src=0x73726576, unsigned long count=15)  Line 314	Asm
 	msvcr90d.dll!memcpy_s(void * dst=0x00cda7b8, unsigned int sizeInBytes=15, const void * src=0x73726576, unsigned int count=15)  Line 67 + 0x11 bytes	C
 	msvcp90d.dll!std::char_traits<char>::_Copy_s(char * _First1=0x00cda7b8, unsigned int _Size_in_bytes=15, const char * _First2=0x73726576, unsigned int _Count=15)  Line 582 + 0x16 bytes	C++
 	msvcp90d.dll!std::_Traits_helper::copy_s<std::char_traits<char> >(char * _First1=0x00cda7b8, unsigned int _Size=15, const char * _First2=0x73726576, unsigned int _Count=15, std::_Secure_char_traits_tag __formal={...})  Line 714 + 0x15 bytes	C++
 	msvcp90d.dll!std::_Traits_helper::copy_s<std::char_traits<char> >(char * _First1=0x00cda7b8, unsigned int _Size=15, const char * _First2=0x73726576, unsigned int _Count=15)  Line 706 + 0x22 bytes	C++
 	msvcp90d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & _Right=<Bad Ptr>, unsigned int _Roff=0, unsigned int _Count=4294967295)  Line 1067 + 0x25 bytes	C++
 	msvcp90d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> >(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & _Right=<Bad Ptr>)  Line 734	C++
>	libpandaexpress_d.dll!Namable::Namable(const Namable & copy={...})  Line 23 + 0x1e bytes	C++
 	libpanda_d.dll!CollisionTraverser::CollisionTraverser(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & name=<Bad Ptr>)  Line 76 + 0x4f bytes	C++
 	test.exe!`dynamic initializer for 'myTraverser''()  Line 13 + 0x49 bytes	C++
 	msvcr90.dll!73502201() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for msvcr90.dll]	
 	test.exe!__tmainCRTStartup()  Line 501 + 0xf bytes	C
 	kernel32.dll!75ad3677() 	
 	ntdll.dll!77b49d72() 	
 	ntdll.dll!77b49d45() 	

It appears that CollisionTraverser doesn’t have a good copy constructor defined. But I wonder if you had really intended to invoke the copy constructor. Did you really mean to write something like this?

CollisionTraverser myTraverser("ctraverser");

Although it looks very similar, it actually means something completely different to the compiler: the above statement invokes the CollisionTraverser constructor only once. Your statement invokes it twice: once to create a temporary in-line instance, and again to copy it into myTraverser.

David

Ah, yeah, you are right. It’s like that because it used to be a pointer so I just removed the “new” and the “*” and I overlooked that. Anyway, this doesn’t change anything, it still crashes. Also, it was working fine with last week’s code so I assumed it was related to a recent commit, which is why I was asking, but if nothing related to that has changed, it must be something else so disregard it.

Well, a crash in the basic_string constructor is one symptom of inadvertently mixing a debug and non-debug build. Are you sure you’ve got the right libraries to match your executable?

David

You are right, it was that. I must have something wrong in my debug profile, cause it works with --optimize 3. Thanks.