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>
This commit is contained in:
Tor Arne Vestbø 2017-04-21 16:09:05 +02:00
parent e4cb8c881f
commit 705c716543
3 changed files with 12 additions and 0 deletions

View File

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

View File

@ -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.

View File

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