We have a small program written in Qt on windows, we use minidump to help us catch client side crash.
Our goal is to at least see the call stack when it crashes.
...
SetUnhandledExceptionFilter(unhandled_handler); // write minidump in unhandled_handler
...
The problem is it doesn't always create minidump after a crash, sometimes the error log shows:
Warning: Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.
Does qt catch the exception and stop my app creating minidump?
There are also times we get useless minidump result, it's Call Stack is:
[Frames may be missing, no binary loaded for KERNELBASE.dll]
KERNELBASE.dll!00007ffd05bd4fd9() Unknown
With output
Unhandled exception at 0x00007FFD05BD4FD9 in SofterClear_1_22_0_220822_141118_061915.dmp: Microsoft C++ exception: std::
According to this :
Throwing an exception from a slot invoked by Qt's signal-slot connection mechanism is considered undefined behaviour, unless it is handled within the slot
I have tried to override QApplication::notify as
bool AlignApplication::notify(QObject * receiver, QEvent * event)
{
bool done = true;
try {
done = QApplication:
}
catch (const std::exception& ex) {
throw ex; // I have also tried to create minidump here, but it's empty and useless.
}
catch (...) {
throw "unknown error";
}
return done;
But it doesn't work.
Is it possible to create minidump with full call stack after an exception happen in Qt slot ?