diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-04-21 16:09:05 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-05-02 19:01:59 +0000 |
commit | 705c716543f2c318dc7b455d881fe0c8a6a467bf (patch) | |
tree | 0ca0a0ed3039c87222e48706a67b99c3ff5ee93e /src | |
parent | e4cb8c881f4c5e99de50a811d6cc7dd911baaa5e (diff) | |
download | qtbase-705c716543f2c318dc7b455d881fe0c8a6a467bf.tar.gz |
macOS: Add auto-release pools for Q*ApplicationPrivate::init()
So that any objects autoreleased during application initialization are
released. Otherwise they will end up in the root level pool and only
be released when the application exits and the application goes out
of scope.
Change-Id: If02d24fd70098f9b4b1b0ea3218e0a15e438b9db
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 4 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index cc8375298d..0104ba0101 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -758,6 +758,10 @@ QCoreApplication::QCoreApplication(int &argc, char **argv void QCoreApplicationPrivate::init() { +#if defined(Q_OS_MACOS) + QMacAutoReleasePool pool; +#endif + Q_Q(QCoreApplication); initLocale(); diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 56f112c36c..1dd019cd55 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1319,6 +1319,10 @@ void QGuiApplicationPrivate::eventDispatcherReady() void QGuiApplicationPrivate::init() { +#if defined(Q_OS_MACOS) + QMacAutoReleasePool pool; +#endif + QCoreApplicationPrivate::init(); QCoreApplicationPrivate::is_app_running = false; // Starting up. diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 0e4ee30c19..4ab43628b9 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -564,6 +564,10 @@ QApplication::QApplication(int &argc, char **argv, int _internal) */ void QApplicationPrivate::init() { +#if defined(Q_OS_MACOS) + QMacAutoReleasePool pool; +#endif + QGuiApplicationPrivate::init(); initResources(); |