diff options
author | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-17 04:54:41 +0000 |
---|---|---|
committer | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-17 04:54:41 +0000 |
commit | a60b5865e906adeae2449c5f63fdd30655b68971 (patch) | |
tree | 6fd0bebef534c1b6a0d1245bd685f9bab3437b6e | |
parent | 394f73ca4d91b5b7d3cf1184bda4fc562b9a2183 (diff) | |
download | chromium_src-a60b5865e906adeae2449c5f63fdd30655b68971.zip chromium_src-a60b5865e906adeae2449c5f63fdd30655b68971.tar.gz chromium_src-a60b5865e906adeae2449c5f63fdd30655b68971.tar.bz2 |
Add a leaked reference to g_browser_process before showing the uninstall dialog to avoid the views framework from erroneously exiting the browser process.
BUG=241366
TEST=Uninstall Chrome while it is set as the default browser. Select an item from the "make other browser default" combobox. Observe that the dialog does not immediately close.
Review URL: https://chromiumcodereview.appspot.com/15134004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200732 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ui/views/uninstall_view.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/ui/views/uninstall_view.cc b/chrome/browser/ui/views/uninstall_view.cc index 5b5fa83..96ae422 100644 --- a/chrome/browser/ui/views/uninstall_view.cc +++ b/chrome/browser/ui/views/uninstall_view.cc @@ -7,6 +7,7 @@ #include "base/message_loop.h" #include "base/process_util.h" #include "base/run_loop.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/ui/uninstall_browser_prompt.h" #include "chrome/common/chrome_result_codes.h" @@ -166,6 +167,16 @@ int ShowUninstallBrowserPrompt(bool show_delete_profile) { DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); int result = content::RESULT_CODE_NORMAL_EXIT; views::AcceleratorHandler accelerator_handler; + + // Take a reference on g_browser_process while showing the dialog. This is + // done because the dialog uses the views framework which may increment + // and decrement the module ref count during the course of displaying UI and + // this code can be called while the module refcount is still at 0. + // Note that this reference is never released, as this code is shown on a path + // that immediately exits Chrome anyway. + // See http://crbug.com/241366 for details. + g_browser_process->AddRefModule(); + base::RunLoop run_loop(&accelerator_handler); UninstallView* view = new UninstallView(&result, run_loop.QuitClosure(), |