| 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(
|
|
|