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>
This commit is contained in:
David Faure 2016-08-07 22:32:33 +02:00
parent 4c002a8343
commit 4e24ff2e68

View File

@ -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);
}