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

Unified Diff: chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc

Issue 412483006: Fixed bug where Uninstall dialog forces its own widget to close twice (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made ExtensionUninstallDialogViews notify ExtensionUninstallDialogDelegateView when it closes, so t… Created 6 years, 4 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/extensions/extension_uninstall_dialog_view.cc
diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
index 16ce3025282636031f65693d34fca4e8b0bfd60b..064c3d83d20ef8078c37330f24569c6d40f6c7e8 100644
--- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
@@ -39,6 +39,10 @@ class ExtensionUninstallDialogViews
extensions::ExtensionUninstallDialog::Delegate* delegate);
virtual ~ExtensionUninstallDialogViews();
+ // Called when the ExtensionUninstallDialogDelegate has been destroyed to make
+ // sure we invalidate pointers.
+ void DialogDelegateDestroyed() { view_ = NULL; }
+
// Forwards the accept and cancels to the delegate.
void ExtensionUninstallAccepted();
void ExtensionUninstallCanceled();
@@ -121,12 +125,14 @@ void ExtensionUninstallDialogViews::Show() {
void ExtensionUninstallDialogViews::ExtensionUninstallAccepted() {
// The widget gets destroyed when the dialog is accepted.
+ view_->DialogDestroyed();
view_ = NULL;
delegate_->ExtensionUninstallAccepted();
}
void ExtensionUninstallDialogViews::ExtensionUninstallCanceled() {
// The widget gets destroyed when the dialog is canceled.
+ view_->DialogDestroyed();
view_ = NULL;
delegate_->ExtensionUninstallCanceled();
}
@@ -154,6 +160,15 @@ ExtensionUninstallDialogDelegateView::ExtensionUninstallDialogDelegateView(
}
ExtensionUninstallDialogDelegateView::~ExtensionUninstallDialogDelegateView() {
+ // If we're here, 2 things could have happened. Either the user closed the
+ // dialog nicely and one of ExtensionUninstallAccepted or
+ // ExtensionUninstallCanceled has been called (in which case dialog_ will be
+ // NULL), *or* neither of them have been called and we are being forced closed
+ // by our parent widget. In this case, we need to make sure to notify dialog_
+ // not to call us again, since we're about to be freed by the Widget
+ // framework.
+ if (dialog_)
+ dialog_->DialogDelegateDestroyed();
}
base::string16 ExtensionUninstallDialogDelegateView::GetDialogButtonLabel(
« 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