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

Unified Diff: ui/views/bubble/bubble_delegate.cc

Issue 24469006: Fixing crash Report - Magic Signature: views::View::ConvertPointToScreen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | « ui/views/bubble/bubble_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/bubble/bubble_delegate.cc
diff --git a/ui/views/bubble/bubble_delegate.cc b/ui/views/bubble/bubble_delegate.cc
index af08994d487f5905b3471e806cfb899664de10e0..8d89ea16448385e718efa11a3fe44a7ce08ce0ce 100644
--- a/ui/views/bubble/bubble_delegate.cc
+++ b/ui/views/bubble/bubble_delegate.cc
@@ -170,10 +170,7 @@ BubbleDelegateView::BubbleDelegateView(
}
BubbleDelegateView::~BubbleDelegateView() {
- if (anchor_widget() != NULL)
- anchor_widget()->RemoveObserver(this);
- anchor_widget_ = NULL;
- anchor_view_ = NULL;
+ DetachFromAnchor();
}
// static
@@ -231,11 +228,8 @@ NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView(
}
void BubbleDelegateView::OnWidgetDestroying(Widget* widget) {
- if (anchor_widget() == widget) {
- anchor_widget_->RemoveObserver(this);
- anchor_view_ = NULL;
- anchor_widget_ = NULL;
- }
+ if (anchor_widget() == widget)
+ DetachFromAnchor();
}
void BubbleDelegateView::OnWidgetVisibilityChanging(Widget* widget,
@@ -257,8 +251,12 @@ void BubbleDelegateView::OnWidgetVisibilityChanged(Widget* widget,
void BubbleDelegateView::OnWidgetActivationChanged(Widget* widget,
bool active) {
- if (close_on_deactivate() && widget == GetWidget() && !active)
+ if (close_on_deactivate() && widget == GetWidget() && !active) {
+ // At this point the original anchor view could be gone and we should make
+ // sure that we do not query it anymore for screen locations.
+ DetachFromAnchor();
GetWidget()->Close();
+ }
}
void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget,
@@ -280,10 +278,14 @@ void BubbleDelegateView::StartFade(bool fade_in) {
// Use AURA's window layer animation instead of fading. This ensures that
// hosts which rely on the layer animation callbacks to close the window
// work correctly.
- if (fade_in)
+ if (fade_in) {
GetWidget()->Show();
- else
+ } else {
+ // At this point the original anchor view could be gone and we should make
+ // sure that we do not query it anymore for screen locations.
+ DetachFromAnchor();
GetWidget()->Close();
+ }
#else
fade_animation_.reset(new gfx::SlideAnimation(this));
fade_animation_->SetSlideDuration(GetFadeDuration());
@@ -298,6 +300,9 @@ void BubbleDelegateView::StartFade(bool fade_in) {
} else {
original_opacity_ = 255;
fade_animation_->Hide();
+ // At this point the original anchor view could be gone and we should make
+ // sure that we do not query it anymore for screen locations.
+ DetachFromAnchor();
}
#endif
}
@@ -437,4 +442,12 @@ void BubbleDelegateView::HandleVisibilityChanged(Widget* widget,
}
}
+void BubbleDelegateView::DetachFromAnchor() {
+ if (!anchor_widget_)
+ return
msw 2013/09/26 22:17:19 This statement needs a semicolon. Have you tested
Mr4D (OOO till 08-26) 2013/09/27 17:22:50 I told you to send a patch within 10 minutes so th
+ anchor_widget_->RemoveObserver(this);
msw 2013/09/26 22:17:19 Do this in an if (anchor_widget) block, and set |a
Mr4D (OOO till 08-26) 2013/09/27 17:22:50 Done.
+ anchor_view_ = NULL;
+ anchor_widget_ = NULL;
+}
+
} // namespace views
« no previous file with comments | « ui/views/bubble/bubble_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698