Crash reporting during a stack overflow exception. Unable to have QDialog exec call

The application that i am working on has a crash reporter associated with it. The crash reporter code is part of the main code. The crash reporter pops up a dialog and if the user chooses to send the crash report, it generates the dump file and send it to an ftp server.

Till now the reporter was working fine, until the application encountered a stack overflow exception. Since the stack has already got depleted, the application is unable to run the crash reporter.

I found the following link useful: http://stackoverflow.com/questions/1610283/step-execution-of-release-code-post-mortem-debugging-vs-c/1613572#1613572

By having the crash dump creation code in a separate thread I was able to generate the dump file. But I am unable to execute the dialog as I am inside a thread. And if I moved the dialog execution to the main program, it doesn’t get executed.

I am using SetUnhandledExceptionFilter to set the exception handler. And inside the handler I am creating the thread and waiting for it to finish.

1
2
HANDLE hMiniDumpThread = ::CreateThread(NULL, 0, MiniDumpThreadProc, &data, 0, &dwScratch);
WaitForSingleObject(hMiniDumpThread, INFINITE);

When I call exec of the dialog in the handler it doesn't work. I am using QDialog to bring out the pop up with which I could collect information from user. Where and how should I add this dialog execution code so that it might run?
So you are using Qt and WinAPI in the same application ? Interesting ...

Why don't get rid of QDialog and use CreateDialog or CreateWindowEx or even MessageBox API directly ? Maybe Qt library is in an inconsistent state during the exception.

Does the application "works" if you skip the dialog box altogether (assume user already pressed "Yes") ?
Last edited on
Yes, If I avoid the dialog I am able to generate the crash dump and proceed. I think you are right about the Qt library being in an inconsistent state. The stack overflow was occuring on one of the Qt dlls. I will check using CreateDialog function.
@modoran, Thanks for the reply. It's working. Thanks.
Topic archived. No new replies allowed.