From ad518d952412a2c1a7268c5d679e1040cce7559c Mon Sep 17 00:00:00 2001
From: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Date: Wed, 5 Nov 2014 18:55:49 +0100
Subject: [PATCH] Fix a shutdown crash under CFAutoreleasePoolPop

NSAutoreleasePool init and dray must be symetrical and we can't guarantee
that for ContentMainRunner as well as Chromium can since we initialize
the ContentMainRunner on-demand but destroy it with the QCoreApplication's
destruction.

We also don't need to use it since any allocation that
ContentMainRunnerImpl::autorelease_pool_ would cover is already covered
at the bottom of the stack by the QCocoaAutoReleasePool in
QCocoaEventDispatcher::processEvents.

Change-Id: I2874916420457e3d36d08fb9fca0d919f374f592
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
---
 chromium/content/app/content_main_runner.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/chromium/content/app/content_main_runner.cc b/chromium/content/app/content_main_runner.cc
index 5db69619305..1f1a5f351d5 100644
--- a/chromium/content/app/content_main_runner.cc
+++ b/chromium/content/app/content_main_runner.cc
@@ -577,7 +577,7 @@ class ContentMainRunnerImpl : public ContentMainRunner {
     }
 #endif  // !OS_ANDROID && !OS_IOS
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) && !defined(TOOLKIT_QT)
     // We need this pool for all the objects created before we get to the
     // event loop, but we don't want to leave them hanging around until the
     // app quits. Each "main" needs to flush this pool right before it goes into
@@ -758,7 +758,7 @@ class ContentMainRunnerImpl : public ContentMainRunner {
     main_params.ui_task = ui_task_;
 #if defined(OS_WIN)
     main_params.sandbox_info = &sandbox_info_;
-#elif defined(OS_MACOSX)
+#elif defined(OS_MACOSX) && !defined(TOOLKIT_QT)
     main_params.autorelease_pool = autorelease_pool_.get();
 #endif
 
@@ -787,7 +787,7 @@ class ContentMainRunnerImpl : public ContentMainRunner {
 #endif  // _CRTDBG_MAP_ALLOC
 #endif  // OS_WIN
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) && !defined(TOOLKIT_QT)
     autorelease_pool_.reset(NULL);
 #endif
 
@@ -816,7 +816,7 @@ class ContentMainRunnerImpl : public ContentMainRunner {
   scoped_ptr<base::AtExitManager> exit_manager_;
 #if defined(OS_WIN)
   sandbox::SandboxInterfaceInfo sandbox_info_;
-#elif defined(OS_MACOSX)
+#elif defined(OS_MACOSX) && !defined(TOOLKIT_QT)
   scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_;
 #endif
 
-- 
GitLab