Index: components/mus/ws/platform_display.cc |
diff --git a/components/mus/ws/platform_display.cc b/components/mus/ws/platform_display.cc |
index 4e7536e9a30619e3c866742e2fb6d69f9eacfe2c..08619e1bcf3d9afe44281965dd1a6c30db4764b7 100644 |
--- a/components/mus/ws/platform_display.cc |
+++ b/components/mus/ws/platform_display.cc |
@@ -200,7 +200,9 @@ void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) { |
} |
DefaultPlatformDisplay::~DefaultPlatformDisplay() { |
- delegate_->OnTopLevelSurfaceChanged(cc::SurfaceId()); |
+ // Don't notify the delegate from the destructor. |
+ delegate_ = nullptr; |
+ |
// Invalidate WeakPtrs now to avoid callbacks back into the |
// DefaultPlatformDisplay during destruction of |top_level_display_client_|. |
weak_factory_.InvalidateWeakPtrs(); |
@@ -399,7 +401,8 @@ void DefaultPlatformDisplay::OnCloseRequest() { |
} |
void DefaultPlatformDisplay::OnClosed() { |
- delegate_->OnDisplayClosed(); |
+ if (delegate_) |
+ delegate_->OnDisplayClosed(); |
} |
void DefaultPlatformDisplay::OnWindowStateChanged( |