My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows
-
Hi,
Here https://github.com/Nelson-numerical-software/nelson
this project already build with Qt 5.x and Qt6.x without troubles on Windows x64I try to use new version Qt 6.6.0, it works with a release build (my code in release with qt 6.6.0 release)
But it crashs when I try to build in debug mode (my code in debug with Qt6.6.0 release)
Have I missed something with the new Qt 6.6.0 release regarding debugging or is this a bug?
official qt.io version 6.6.0 with up to date msvc 2022 compiler
-
@Nelson-numerical-software Please post stack trace after the crash
-
@Nelson-numerical-software So, what are you doing in Highlighter constrcutor (post its code)?
-
Do you access this from different threads without proper locking?
-
-
one thread for gui
one thread for algo.Same code with qt6.5 in debug mode (with qt release mode) on windows does not crash.
I will try with debug version of qt6.6 if I have same behavior.
-
@Nelson-numerical-software said in My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows:
one thread for gui
one thread for algo.So, do you manipulate UI from the algo thread or not? This is not supported and can lead to crashes.
And please post code as text not pictures. -
current examples with crash are simple call to gui feature.
I do not manipulate ui from algo.
In release mode, it works with qt6.6.0 but not in debug
same code also works in Qt6.5.0 in debug mode.00007ffa467acb2c() 00007ffa467b0275() 00007ffa467b0988() QArrayDataPointer<QString>::~QArrayDataPointer<QString>() [Code externe] Nelson::HelpCollection::getRegisteredFiles() Nelson::HelpBrowser::getAttributes() Nelson::HelpBrowserGateway::helpbrowserBuiltin(int, const Nelson::ListVector<Nelson::ArrayOf> &) Nelson::EvaluateBuiltinCatchRuntimeException(Nelson::Evaluator *, void *, const Nelson::ListVector<Nelson::ArrayOf> &, int, unsigned __int64, bool)
Please also notice that if I comment in QArrayDataPointer
(Qt\6.6.0\msvc2019_64\include\QtCore\qarraydatapointer.h)
line 104 free(d)It works in debug mode
-
@Nelson-numerical-software
Just because something does work in different versions of Qt or between release and debug mode does not mean that code is correct. Bugs show up (or don't show up) under many different circumstances.I would start by concentrating on the question about whether you may be accessing the UI from a secondary thread. We have seen this countless times in people's code, even when they claim not to be doing so. Try your code without threads? Produce some minimal example which illustrates the crash?
-
Sure ;)
When you invest in Qt for a long time. You can also expect to no have some breaking change without visible warnings :p
Anyway it was not a complaint. It was just that I constated Qt6.2, 6.5 works in these cases and not 6.6.0
I will survey the class QArrayDataPointer and previous tickets fixed in Qt6.6.0 about it.
Thanks for your help
-
QArrayDataPointer is a fundamental piece of a lot of basic qt classes. I doubt you found a bug in there. You do something wrong with your threading.
-
@Nelson-numerical-software said in My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows:
When you invest in Qt for a long time. You can also expect to no have some breaking change without visible warnings :p
That is true if your code is correct. However, if your code has some "fault" which has not shown up before and happens to go wrong now with a change of environment this happens. And it is the case that where a threading issue is involved you never know what changed circumstances may make it appear. It is the same with any code, nothing to do with Qt.
-
Thank you for these comprehensive comments. :)
Great work from the developers for this 6.6.0 with many new features.
I have my answer
-
-
Your pragma(lib) stuff in dllmain.cpp is wrong. You must not mix debug and release libraries on windows. I would remove this MSVC only stuff and let do cmake the correct things.
-
-
@Christian-Ehrlicher said in My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows:
Your pragma(lib) stuff in dllmain.cpp is wrong. You must not mix debug and release libraries on windows. I would remove this MSVC only stuff and let do cmake the correct things.
I confirm that it was the trouble
on windows debug build must be linked with Qt debug library
Thanks for your time and investigations
-
Can you explain what you changed to fix this issue ?
As I am also facing the similar problem. I am using already built MSVC 2019 64 bit compiled libraries from QT 6.6.3 with VS 2022 C++ 64 bit application. My application is wrote for Debug and Release configuration. In both modes the crash is happening. -
Thanks @Nelson-numerical-software I had the exact same problem too. Easy mistake to make in Visual C++ when updating Qt versions and modifying linker input file list.
-
@KeithS said in My Qt 6.6.0 code crashs in debug mode (~QArrayDataPointer()) and not on release on Windows:
and modifying linker input file list.
That's the reason to use a build system like e.g. CMake.