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

Unified Diff: ui/arc/notification/arc_custom_notification_view.cc

Issue 2120593002: arc: Fix custom notification crash on closing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/arc/notification/arc_custom_notification_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/arc/notification/arc_custom_notification_view.cc
diff --git a/ui/arc/notification/arc_custom_notification_view.cc b/ui/arc/notification/arc_custom_notification_view.cc
index a87669382fae387dbac59bb147197d889f752aae..cd5f6c1359a7cf665ef9924cb7b7d0fa42b97b52 100644
--- a/ui/arc/notification/arc_custom_notification_view.cc
+++ b/ui/arc/notification/arc_custom_notification_view.cc
@@ -77,7 +77,7 @@ void ArcCustomNotificationView::ViewHierarchyChanged(
views::NativeViewHost::ViewHierarchyChanged(details);
- if (!widget || !details.is_add)
+ if (!widget || !surface_ || !details.is_add)
return;
SetPreferredSize(surface_->GetSize());
@@ -87,7 +87,7 @@ void ArcCustomNotificationView::ViewHierarchyChanged(
void ArcCustomNotificationView::Layout() {
views::NativeViewHost::Layout();
- if (!floating_close_button_widget_ || !GetWidget())
+ if (!floating_close_button_widget_ || !surface_ || !GetWidget())
return;
gfx::Rect surface_local_bounds(surface_->window()->bounds().size());
@@ -108,6 +108,10 @@ void ArcCustomNotificationView::ButtonPressed(views::Button* sender,
void ArcCustomNotificationView::OnItemDestroying() {
item_->RemoveObserver(this);
item_ = nullptr;
+
+ // Reset |surface_| with |item_| since no one is observing the |surface_|
+ // after |item_| is gone and this view should be removed soon.
+ surface_ = nullptr;
}
void ArcCustomNotificationView::OnItemPinnedChanged() {
@@ -118,4 +122,8 @@ void ArcCustomNotificationView::OnItemPinnedChanged() {
}
}
+void ArcCustomNotificationView::OnItemNotificationSurfaceRemoved() {
+ surface_ = nullptr;
+}
+
} // namespace arc
« no previous file with comments | « ui/arc/notification/arc_custom_notification_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698