From fd7b52d268ab3f9cdcdb06a77b715644d2d22ef3 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 13 Mar 2013 10:34:18 +0100 Subject: [PATCH] Make QCoreApplication::startingUp() return false when appropriate. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, QCoreApplication::startingUp() returns true even after a QCoreApplication has been constructed. This patch makes it return false after it has been constructed and adds checks to QApplication and QGuiApplication to ensure that it returns true within the constructor of these classes. Task-number: QTBUG-2591 Change-Id: Ie511522d35b5658c20be43dd112eae18c205277f Reviewed-by: Jędrzej Nowacki Reviewed-by: Friedemann Kleint Reviewed-by: Samuel Rødal --- src/corelib/kernel/qcoreapplication.cpp | 2 ++ src/gui/kernel/qguiapplication.cpp | 2 ++ src/widgets/kernel/qapplication.cpp | 6 ++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index ec808424f9f..02d4d0376a3 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -638,6 +638,8 @@ void QCoreApplication::init() d->processCommandLineArguments(); qt_startup_hook(); + + QCoreApplicationPrivate::is_app_running = true; // No longer starting up. } /*! diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index d0b37b7f1b3..d42da6ee79c 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -926,6 +926,8 @@ static bool runningUnderDebugger() void QGuiApplicationPrivate::init() { + QCoreApplicationPrivate::is_app_running = false; // Starting up. + bool doGrabUnderDebugger = false; QList pluginList; // Get command line params diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 4c6d8cfdc72..7f41e5c5769 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -588,6 +588,8 @@ extern void qRegisterWidgetsVariant(); */ void QApplicationPrivate::initialize() { + is_app_running = false; // Starting up. + QWidgetPrivate::mapper = new QWidgetMapper; QWidgetPrivate::allWidgets = new QWidgetSet; @@ -601,8 +603,6 @@ void QApplicationPrivate::initialize() qRegisterGuiStateMachine(); #endif - is_app_running = true; // no longer starting up - Q_Q(QApplication); if (qgetenv("QT_USE_NATIVE_WINDOWS").toInt() > 0) @@ -629,6 +629,8 @@ void QApplicationPrivate::initialize() if (QApplication::desktopSettingsAware()) if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) QApplicationPrivate::enabledAnimations = theme->themeHint(QPlatformTheme::UiEffects).toInt(); + + is_app_running = true; // no longer starting up } /*****************************************************************************