Re: Problems with file xstring (V3.13:0009) - suspicion: function _Myptr() is wrong
bernhard.nowara@de.thalesgroup.com wrote:
After porting our software from VC6.00 to VC7.1 we have problems with
the STL. Occasionally an exception is thrown from within msvcr71d.dll.
Analysing the callstack
msvcr71d.dll!memcpy(unsigned char * dst=0xcdcdcdcd, unsigned char *
src=0x01bb0f50, unsigned long count=32) Zeile 218 Asm
msvcp71d.dll!std::char_traits<char>::copy(char * _First1=0xcdcdcdcd,
const char * _First2=0x01bb0f50, unsigned int _Count=32) Zeile 448 +
0x11 C++>
0xcdcdcdcd is a signal value that the debugger uses for uninitialised
memory, so something is wrong here.
[...]
reveals that the last 'user statement' is a simple assignment
void MsgQosData::setSubscriptionId(const string& subscriptionId)
{
subscriptionId_ = subscriptionId;
}
[...]
Does anyone have an idea how to solve the problem?
Any suggestions and hints are welcome
I have seen similar behaviour in two cases:
1. The object (in this case subscriptionId_) has not yet been constructed.
2. The object has already been destroyed.
There are various ways to do that, dangling pointers, constructor calls
looping back on the object itself or multithreading issues. Typically,
looking further up the call stack should reveal the first two possible
causes. The third one is a bit more difficult but it usually involves first
checking the proper ownership management and synchronisation of the object
itself (or its enclosing object). Other than that, std::string of VC7.1 is
rather stable, I'm not aware of any bugs in it.
Uli