PDA

View Full Version : Crash gracefully: How to ignore microsoft abort dialog?



lni
10th May 2009, 16:05
Hi,

I have finally implemented exception handler rasied by operating system (such as SEGV or abort) and ignore it, so that the GUI application can continue instead of crashing the application. That works in both Linux and Windows.

However, there is a problem with Windows version when test with "abort()", that the Window libraries intercept the abort() before my signal handler can intercept it, which pop up a dialog as shown in the attachment (first figure). After I clik "Retry", it will then get to my exception handler and ignore the signal (second figure)...

Does anyone know how to prevent microsoft library from intercepting the abort()?


Thanks

rbp
11th May 2009, 02:13
I'm having the same problem with the windows crash dialog: http://www.qtcentre.org/forum/f-qt-programming-2/t-how-to-crash-gracefully-page2-20759.html

talk2amulya
11th May 2009, 09:45
guys,

that is an assert failure..a debug error..when u'd run your app in release or with QT_NO_DEBUG(if i recall correctly), it wont come..and since your app will go to the customer in release only, you dont need to worry about it.

lni
11th May 2009, 18:45
guys,

that is an assert failure..a debug error..when u'd run your app in release or with QT_NO_DEBUG(if i recall correctly), it wont come..and since your app will go to the customer in release only, you dont need to worry about it.

The worse thing is that it simply crashes my application in release mode. User don't even have chance to get to my exception handler...

I am using the following test case:




QList<int> a
a[ 0 ] = 0



In release mode (in Linux), here is the error I got:

*** glibc detected *** free(): invalid next size (fast): 0x00000000005dfb80 ***

The application is then freezed...

rbp
14th May 2009, 00:43
hi Ini,

thanks very much for sharing the code sample and apologies for the delay in testing it!
Before I could compile I needed to comment out this signal block:

#if !defined(Q_WS_WIN)
...
#endif
because they are not defined on my platform (Windows XP).

I found that the first time I pressed an error button an error dialog usually popped up but the app could continue (wow!). But the second time I pressed it I would get an unhandled exception and the app would shut down. I experienced this in both release and debug mode.


A few questions and comments:

- Why is SIGINT commented out?
- If you close the application normally you will get here:

qDebug() << "Should not get here!!";
- I want to exit gracefully on an error so I have trigger() throw an exception, which I catch in main.

Richard