summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2016-08-07 22:32:33 +0200
committerDavid Faure <david.faure@kdab.com>2016-08-12 08:26:59 +0000
commit4e24ff2e68f942db1d8f90de43dae8db410e706b (patch)
tree8d2fc29a7ae58ef14bee5d884d2b472c243054f8 /src/corelib/tools
parent4c002a8343baa8453a5485ce7939569bfc5b3267 (diff)
QCommandLineParser: call qCoreApp post routines before ::exit()
This gives a chance for some cleanups at least. Change-Id: I3a628e32c6fc8c7fa00943769210c517005f2a0a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qcommandlineparser.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp
index 2bc60c5b9e..fa163cf441 100644
--- a/src/corelib/tools/qcommandlineparser.cpp
+++ b/src/corelib/tools/qcommandlineparser.cpp
@@ -46,6 +46,8 @@
QT_BEGIN_NAMESPACE
+extern void Q_CORE_EXPORT qt_call_post_routines();
+
typedef QHash<QString, int> NameHash_t;
class QCommandLineParserPrivate
@@ -580,6 +582,7 @@ void QCommandLineParser::process(const QStringList &arguments)
{
if (!d->parse(arguments)) {
showParserMessage(errorText() + QLatin1Char('\n'), ErrorMessage);
+ qt_call_post_routines();
::exit(EXIT_FAILURE);
}
@@ -990,6 +993,7 @@ Q_NORETURN void QCommandLineParser::showVersion()
showParserMessage(QCoreApplication::applicationName() + QLatin1Char(' ')
+ QCoreApplication::applicationVersion() + QLatin1Char('\n'),
UsageMessage);
+ qt_call_post_routines();
::exit(EXIT_SUCCESS);
}
@@ -1007,6 +1011,7 @@ Q_NORETURN void QCommandLineParser::showVersion()
Q_NORETURN void QCommandLineParser::showHelp(int exitCode)
{
showParserMessage(d->helpText(), UsageMessage);
+ qt_call_post_routines();
::exit(exitCode);
}