My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows
-
Hi guys. I just came to the same issue on 6.8.2 where even the code below crashes on exactly the same space as above where the code run perfect before. So what changed... the build was done on w10 (months ago) and then after a format w11 was installed with a clean VS2022 installation. Since this happened qt crashes all the time. Now project didn't change so w10->w11 transition has to be the culprit. I'll edit this post after I'll rebuild 6.8.2 on w11.
int main( int argc, char *argv[] )
{
QVector<JSON_Object> value_object_list;JSON_Object e1; JSON_Object e2; JSON_Object e3; JSON_Object e4; JSON_Object e5; value_object_list.append( e1 ); value_object_list.append( e2 ); value_object_list.append( e3 ); value_object_list.append( e4 ); value_object_list.append( e5 );
-
Don't mix debug and release libraries.
-
I found one of my debug dll was compiled by using runtime library
MultiThreadedDLL
.
After change C/C++ -> runtime library asMultiThreadedDebugDLL
in visual studio, the problem is gone.Use the tool
Dependencies
, I can see the bad dll is using:And the good dll is using:
-
Created a new project, build it and all was fine (the same code). And as stated above the reason was mixing of debug/non-debug libraries.
Now the whole issue as it looks occurred when that Project->Options->Advanced->Use Debug Libraries was set to No (in all VS versions I have never set this value to anything.. I assume it came with VS22). Which caused that Compiler->Code Generation->Runtime libraries switched to non-debug version in the background.So the solution is to switch the 'Use Debug Libraries' to true and all will be ok.