Why is my QT Application breaking in disassembly code on debug start?
-
My QT application has been running fine on my Windows 11 machine for almost two years since I took over development for it. Recently what's happened is that when I start the program in debug mode, it first breaks in disassembly code with the following exception trigger pop up message:
The inferior stopped because it triggered an exception. Stopped in thread 0 by: Exception at 0x772a1fdf, code: 0xc0000005: read access violation at: 0xbaadf00c, flags=0x0 (first chance).
The disassembler stops here:
Running the code after this exception is triggered launches the program, but the program will occasionally break in disassembler again and crash.
I am compiling with MSVC and I've tried a number of different compilers and have tried QT versions 5.2.0, 5.14.1, and 5.15.2 and all produce the same error on Windows 11. I have also tried different combinations of Windows SDK packages, and all produce the same result. I have tried VS Build tools 2015, 2017, and 2019 with no change.
I ended up installing Windows 10 on another machine and ran the setup with QT 5.14.1, MSVC compiler 15.9.28307.2094, and Windows 10 SDK 10.0.17763.132 where it runs as expected with no problems.
This one has really confused me.
QT Setup on my Win 11 machine:
-
-
I am using QT Creator as my build and debug tool. This is not an issue with the code. I just created a new QT project with the base code that is provided by default, and that gives me the same error:
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
My QT Creator "about" window:
-
@jabroni What is the stack backtrace when the failure occurs. The original error message is from attempting to access memory that does not belong to your process or accessing through a null pointer. In this case the address is in EAX and is 0xbaadf00c (which looks suspiciously like a common flag value 0xbaadf00d (bad food)).
If you put a breakpoint on the first line inside main() does the program get that far?
What non-Qt libraries, ActiveX controls etc are linked to your application?
-
@ChrisW67 I'll just focus on the main.ccp file in the Applications example project now as that should be what everyone else has.
Just as my program, the "crash" occurrs once the
.show()
function is called. In this case it'smainWin.Show()
. Stepping over/into that fails to disassembler:
and this is the stack trace:
Also, in my main application I am developing, the only external library that is used is QWT 6.1.3 (as far as I am aware - please let me know if there's a way I can check this). However, even with the Application example project which is 80 lines of code the same error occurs.
-
@hskoglund So:
Release Mode
Start with debugging = same crash
Start with no debugging = no crashDebug mode
Same as aboveSo it looks like debug run is the issue here I think.
And these are the buttons I am referring to when I say "start with debugging":
-
@hskoglund well okay that omits that error from startup haha. Which solves that problem, however if I enter a breakpoint during debug runtime of my application it breaks into disassembler code:
ntdll!DbgBreakPoint: 0x772c8c00 int 3 0x772c8c01 <+ 1> ret 0x772c8c02 <+ 2> int 3
-
@jabroni Hi, I've met same issue with you.
But not as your case, my code have a problem with "tr" function when using with static variable.
I fix that follow the guide here https://forum.qt.io/topic/33568/qt-tr-not-working-if-i-am-using-in-static-member
Hope it can help you.