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

Unified Diff: ash/shelf/shelf_widget.cc

Issue 2000393003: ash: Reorder shutdown of ShelfLayoutManager and StatusAreaWidget (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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 | « ash/shelf/shelf_widget.h ('k') | ash/shell.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_widget.cc
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc
index 216b0901d32855775fe45832886cfcc803346162..c504175f376135bca0b98bd47f7791ba2d2343d8 100644
--- a/ash/shelf/shelf_widget.cc
+++ b/ash/shelf/shelf_widget.cc
@@ -265,7 +265,7 @@ class ShelfWindowTargeter : public ::wm::EasyResizeWindowTargeter,
}
// ShelfLayoutManagerObserver:
- void WillDeleteShelf() override {
+ void WillDeleteShelfLayoutManager() override {
shelf_->RemoveObserver(this);
shelf_ = NULL;
}
@@ -603,6 +603,8 @@ ShelfWidget::ShelfWidget(aura::Window* shelf_container,
}
ShelfWidget::~ShelfWidget() {
+ // Must call Shutdown() before destruction.
+ DCHECK(!status_area_widget_);
Shell::GetInstance()->focus_cycler()->RemoveWidget(this);
SetFocusCycler(nullptr);
RemoveObserver(this);
@@ -751,12 +753,19 @@ FocusCycler* ShelfWidget::GetFocusCycler() {
return delegate_view_->focus_cycler();
}
-void ShelfWidget::ShutdownStatusAreaWidget() {
+void ShelfWidget::Shutdown() {
+ // Shutting down the status area widget may cause some widgets (e.g. bubbles)
+ // to close, so uninstall the ShelfLayoutManager event filters first. Don't
+ // reset the pointer until later because other widgets (e.g. app list) may
+ // access it later in shutdown.
+ if (shelf_layout_manager_)
+ shelf_layout_manager_->PrepareForShutdown();
+
if (status_area_widget_) {
Shell::GetInstance()->focus_cycler()->RemoveWidget(status_area_widget_);
status_area_widget_->Shutdown();
+ status_area_widget_ = nullptr;
}
- status_area_widget_ = NULL;
}
void ShelfWidget::ForceUndimming(bool force) {
@@ -789,7 +798,7 @@ void ShelfWidget::DisableDimmingAnimationsForTest() {
return delegate_view_->disable_dimming_animations_for_test();
}
-void ShelfWidget::WillDeleteShelf() {
+void ShelfWidget::WillDeleteShelfLayoutManager() {
shelf_layout_manager_->RemoveObserver(this);
shelf_layout_manager_ = NULL;
}
« no previous file with comments | « ash/shelf/shelf_widget.h ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698