I have following code:
CAtlString str = currentFolder->whatsThis().toStdWString().c_str();
currentFolder is qt QTreeWidgetItem*. When I run program from VS2010 it works ok. But when I start program by double click in the same folder (x64/Debug or Release), I have exceptions:
Unhandled exception at 0x00007ffe2a07572a (ntdll.dll) in test.exe: 0xC0000005: Access violation reading location 0xffffffffffffffff.
on dealloc in basic_string destructor:
~basic_string() // xstring
{ // destroy the string
_Tidy(true);
}
// ...
void deallocate(pointer _Ptr, size_type) // in xmemory
{ // deallocate object at _Ptr, ignore size
::operator delete(_Ptr);
}
I`m trying to delete string directly, clean, erase - but every time I had the same result. Also I had tried to use different runtimes and deploy packages, without lucky. (searched with Dependency Walker). Why program works under VS2010? And how can I fix standalone running? thx!
Update This is the minimal code reproduced the problem: zalil.ru use x64 config and run program by double click for catch the exception.
Update2 if I keep wstring pointer alive (using temp variable), I have following error:

whatsThis()andtoStdWString()built in functions or are they yours? If they are your can you show there code?currentFolderis object ofQTreeWidgetItemclass. So those mehods are qt built-in((QTreeWidgetItem*)nullptr)->whatsThis()will return something invalid, as I said in my answer