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

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

Issue 2850403002: Fix crash under ExclusiveAccessBubbleViews::AnimationProgressed(). (Closed)
Patch Set: Fix lifetime, clang Created 3 years, 8 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
Index: chrome/browser/ui/views/exclusive_access_bubble_views.cc
diff --git a/chrome/browser/ui/views/exclusive_access_bubble_views.cc b/chrome/browser/ui/views/exclusive_access_bubble_views.cc
index b556c88b3dbddd219b87d267ca7472b4ff7f5870..3702f8eff21d59a74a83378feacbe85dc6607d07 100644
--- a/chrome/browser/ui/views/exclusive_access_bubble_views.cc
+++ b/chrome/browser/ui/views/exclusive_access_bubble_views.cc
@@ -282,6 +282,24 @@ void ExclusiveAccessBubbleViews::Observe(
UpdateMouseWatcher();
}
+void ExclusiveAccessBubbleViews::OnWidgetDestroyed(views::Widget* widget) {
+ // Although SubtleNotificationView uses WIDGET_OWNS_NATIVE_WIDGET, a close can
msw 2017/05/03 18:48:33 Would using the default NATIVE_WIDGET_OWNS_WIDGET
tapted 2017/05/04 06:42:07 I think this added complexity would remain. That i
+ // originate from the OS or some Chrome shutdown codepaths that bypass the
+ // destructor.
+ views::Widget* popup_on_stack = popup_;
+ DCHECK(popup_on_stack->HasObserver(this));
+
+ // Get ourselves destroyed. Calling ExitExclusiveAccess() won't work because
+ // the parent window might be destroyed as well, so asking it to exit
+ // fullscreen would be a bad idea.
+ bubble_view_context_->DestroyAnyExclusiveAccessBubble();
+
+ // Note: |this| is destroyed on the line above. Check that the destructor was
+ // invoked. Note this is safe to do since |popup_| is deleted via a posted
msw 2017/05/03 18:48:33 optional nit: remove "Note" to avoid an extra line
tapted 2017/05/04 06:42:07 Done.
+ // task.
+ DCHECK(!popup_on_stack->HasObserver(this));
+}
+
void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged(
views::Widget* widget,
bool visible) {

Powered by Google App Engine
This is Rietveld 408576698