| Index: chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
|
| diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
|
| index 45a0c5e8b1b323d18e0e8fab35e4e87162fc844b..d18bc3352bf15960a876d2c1d3224fb6a1fc6b3b 100644
|
| --- a/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
|
| +++ b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
|
| @@ -34,13 +34,17 @@ AutofillPopupViewViews::AutofillPopupViewViews(
|
| observing_widget_(NULL) {}
|
|
|
| AutofillPopupViewViews::~AutofillPopupViewViews() {
|
| +}
|
| +
|
| +void AutofillPopupViewViews::Hide() {
|
| + AutofillPopupView::Hide();
|
| +
|
| if (observing_widget_)
|
| observing_widget_->RemoveObserver(this);
|
|
|
| - controller_->ViewDestroyed();
|
| -}
|
| + // The controller is no longer valid after it hides us.
|
| + controller_ = NULL;
|
|
|
| -void AutofillPopupViewViews::Hide() {
|
| if (GetWidget()) {
|
| // This deletes |this|.
|
| GetWidget()->Close();
|
| @@ -50,6 +54,13 @@ void AutofillPopupViewViews::Hide() {
|
| }
|
|
|
| void AutofillPopupViewViews::OnPaint(gfx::Canvas* canvas) {
|
| + // This can happen if we have a paint message in the queue when the popup
|
| + // is told to hide (so the controller is invalid at this point). Its ok to
|
| + // avoid drawing popup, sine we don't have access to the data anymore, and it
|
| + // should be hidden soon.
|
| + if (!controller_)
|
| + return;
|
| +
|
| canvas->DrawColor(kPopupBackground);
|
| OnPaintBorder(canvas);
|
|
|
| @@ -106,7 +117,7 @@ void AutofillPopupViewViews::OnMouseReleased(const ui::MouseEvent& event) {
|
| void AutofillPopupViewViews::OnWidgetBoundsChanged(
|
| views::Widget* widget,
|
| const gfx::Rect& new_bounds) {
|
| - Hide();
|
| + controller_->Hide();
|
| }
|
|
|
| void AutofillPopupViewViews::Show() {
|
|
|