开发者

Platform independent way of setting a unhandled exception handler using Qt?

Mac OS X (Cocoa) NSSetUncaughtExceptionHandler

Windows SetUnhandledExceptionFilter

Is there a platform independent way to d开发者_运维问答o this using Qt?


Would it really be so bad to have to write #ifdefs around this? It's just a single instance and you'll never have to look at it again once you finish it. That being said at least on Windows, I'd encourage you to not do this, and instead register for Vista+'s Restart Manager if it's available.


What about obvious handler in main()? I mean your application have following lines:

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow mainWin;
    mainWin.show();
    return a.exec();
}

What about simple wrap it with:

try{
   QApplication a(argc, argv);
   ...
}
catch //catches any previously unhandled
{
    //do graceful exit
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜