1

I'm trying to integrate Crashpad with Qt, with some QML in my code.

Here the crash report is generated successfully without any issue.

CrashpadClient *client = initializeCrashpad();

if (!client) {
    std::cout << "Crash not processed";
}
    
QApplication a(argc, argv);

//Here it generates a crash report
//but I don't need it here
std::cout << 3 / 0;

QQuickView* view = new QQuickView;

view->setSource(QUrl::fromLocalFile("InteractiveComboBox.qml"));
view->show();
       
a.exec();

But If I do make a crash happen after initializing Qml, it's not able to generate a report.

CrashpadClient *client = initializeCrashpad();

if (!client) {
    std::cout << "Crash not processed";
}
    
QApplication a(argc, argv);

QQuickView* view = new QQuickView;

view->setSource(QUrl::fromLocalFile("InteractiveComboBox.qml"));
view->show();

//Here it doesn't generate a crash report
//and I need it here
std::cout << 3 / 0;
       
a.exec();

How do I make it generate a crash report after executing QML code?

Update : For a workaround on this, I reinitialized crashpad after view->show()

1 Answers1

0

Calling the show() function in main resets the UnhandledExceptionFilter. You can do something like this.

auto exceptionFilter = SetUnhandledExceptionFilter(NULL);
view->show();
SetUnhandledExceptionFilter(exceptionFilter);

In this example, we set the UnhandledExceptionFilter to NULL to get the pointer to previous UnhandledExceptionFilter. After calling the show() function we use this pointer to call SetUnhandledExceptionFilter() and this reset