Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3545)

Unified Diff: chrome/browser/ui/views/uninstall_view.cc

Issue 15134004: Add a leaked reference to g_browser_process before showing the uninstall dialog to avoid the views … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/uninstall_view.cc
diff --git a/chrome/browser/ui/views/uninstall_view.cc b/chrome/browser/ui/views/uninstall_view.cc
index 5b5fa83f407afd290ea296a32036cd159c4b444f..96ae4227bbb01b91e9fdd72c6ab2c7c379bc8054 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();
sky 2013/05/16 19:26:50 How does the ref count end up hitting 0 here?
+
base::RunLoop run_loop(&accelerator_handler);
UninstallView* view = new UninstallView(&result,
run_loop.QuitClosure(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698