summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@idiap.ch>2018-11-15 23:29:32 +0100
committerSamuel Gaist <samuel.gaist@idiap.ch>2018-11-16 12:19:19 +0000
commitb6a5aff9b7781fb98529e9a4beab0c2f43ac55fe (patch)
tree62740ef2914f09ff5421aa79439907e8211c3247
parent113e24a5aabe6917b7f3d65f342bb5fff9bc3b08 (diff)
downloadqtdoc-b6a5aff9b7781fb98529e9a4beab0c2f43ac55fe.tar.gz
Improve the exception safety code sample
This patch improves the code by showing better handling of the exit code. Change-Id: I10f44a93fe342bfd998b717f71ad16216e921d7b Fixes: QTBUG-71587 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
-rw-r--r--doc/src/howtos/exceptionsafety.qdoc6
1 files changed, 4 insertions, 2 deletions
diff --git a/doc/src/howtos/exceptionsafety.qdoc b/doc/src/howtos/exceptionsafety.qdoc
index 0eb674c2..461f275e 100644
--- a/doc/src/howtos/exceptionsafety.qdoc
+++ b/doc/src/howtos/exceptionsafety.qdoc
@@ -116,13 +116,15 @@
QApplication app(argc, argv);
...
try {
- app.exec();
+ int ret = app.exec();
} catch (const std::bad_alloc &) {
// clean up here, e.g. save the session
// and close all config files.
- return 0; // exit the application
+ return EXIT_FAILURE; // exit the application
}
+ ...
+ return ret;
\endcode
After an exception is thrown, the connection to the windowing server