Iam getting CRT Heap corruption detected message, when running the following simple c++ code. The error comes from ::free method called by QMap destrcutor.
void foo() {
QMap<QString, QVariant> map;
map["Sample1"] = 2;
map["Sample2"] = 3;
}
void foo() {
QMap<QString, QVariant> map;
map["Sample1"] = 2;
map["Sample2"] = 3;
}
To copy to clipboard, switch view to plain text mode
I am using Qt 5.5.1 (It built Qt with Visual Studio 2013 and configure it to target windows xp(using v120_xp toolset)).
Preconditions:
My operating system is Windows 8 64 bit.
I changed the Platform Tools property to Visual Studio 2013 - Windows XP (v120_xp).
When I change the code to following, the error is gone.
void foo() {
QMap<QString, int> map; // Change the second type from QVariant to int
map["Sample1"] = 2;
map["Sample2"] = 3;
}
void foo() {
QMap<QString, int> map; // Change the second type from QVariant to int
map["Sample1"] = 2;
map["Sample2"] = 3;
}
To copy to clipboard, switch view to plain text mode
Any help will be appreciated.
Stacktrace contains following lines:
msvcr120d.dll!_free_dbg_nolock(void * pUserData, int nBlockUse) Line 1376 C++
msvcr120d.dll!_free_dbg(void * pUserData, int nBlockUse) Line 1265 C++
msvcr120d.dll!free(void * pUserData) Line 49 C++
Qt5Cored.dll!qMapDeallocate(QMapNodeBase * node, int alignment) Line 318 C++
Qt5Cored.dll!QMapDataBase::freeTree(QMapNodeBase * root, int alignment) Line 349 C++
Qt5Cored.dll!QMapDataBase::freeTree(QMapNodeBase * root, int alignment) Line 349 C++
Armaghan.exe!QMapData<QString,QVariant>::destroy() Line 225 C++
Armaghan.exe!QMap<QString,QVariant>::~QMap<QString,QVariant>() Line 339 C++
Armaghan.exe!foo() Line 32 C++
Armaghan.exe!main(int argc, char * * argv) Line 37 C++
[External Code]
msvcr120d.dll!_free_dbg_nolock(void * pUserData, int nBlockUse) Line 1376 C++
msvcr120d.dll!_free_dbg(void * pUserData, int nBlockUse) Line 1265 C++
msvcr120d.dll!free(void * pUserData) Line 49 C++
Qt5Cored.dll!qMapDeallocate(QMapNodeBase * node, int alignment) Line 318 C++
Qt5Cored.dll!QMapDataBase::freeTree(QMapNodeBase * root, int alignment) Line 349 C++
Qt5Cored.dll!QMapDataBase::freeTree(QMapNodeBase * root, int alignment) Line 349 C++
Armaghan.exe!QMapData<QString,QVariant>::destroy() Line 225 C++
Armaghan.exe!QMap<QString,QVariant>::~QMap<QString,QVariant>() Line 339 C++
Armaghan.exe!foo() Line 32 C++
Armaghan.exe!main(int argc, char * * argv) Line 37 C++
[External Code]
To copy to clipboard, switch view to plain text mode
Bookmarks