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

Unified Diff: ui/aura_shell/shell.cc

Issue 8774029: Delete desktop/shell instance correctly when chrome is shutting down (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: close windows before observers are destroyed. Created 9 years 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/aura_shell/shell.h ('k') | ui/aura_shell/test/aura_shell_test_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura_shell/shell.cc
diff --git a/ui/aura_shell/shell.cc b/ui/aura_shell/shell.cc
index 32c84bd0dc8d117fc3028e118f7b412459a37e0f..ded7967c1defb0547c5f3c8141d6b4d95f4309f2 100644
--- a/ui/aura_shell/shell.cc
+++ b/ui/aura_shell/shell.cc
@@ -127,6 +127,21 @@ Shell::~Shell() {
RemoveDesktopEventFilter(tooltip_manager_.get());
aura::Desktop::GetInstance()->SetProperty(aura::kDesktopTooltipClientKey,
NULL);
+
+ // Make sure we delete WorkspaceController before launcher is
+ // deleted as it has a reference to launcher model.
+ workspace_controller_.reset();
+ launcher_.reset();
+
+ // Delete containers now so that child windows does not access
+ // observers when they are destructed. This has to be after launcher
+ // is destructed because launcher closes the widget in its destructor.
+ aura::Desktop* desktop_window = aura::Desktop::GetInstance();
+ while (!desktop_window->children().empty()) {
+ aura::Window* child = desktop_window->children()[0];
+ delete child;
+ }
+
tooltip_manager_.reset();
// Drag drop controller needs a valid shell instance. We destroy it first.
@@ -134,10 +149,6 @@ Shell::~Shell() {
DCHECK(instance_ == this);
instance_ = NULL;
-
- // Make sure we delete WorkspaceController before launcher is
- // deleted as it has a reference to launcher model.
- workspace_controller_.reset();
}
// static
@@ -155,7 +166,7 @@ Shell* Shell::GetInstance() {
}
// static
-void Shell::DeleteInstanceForTesting() {
+void Shell::DeleteInstance() {
delete instance_;
instance_ = NULL;
}
« no previous file with comments | « ui/aura_shell/shell.h ('k') | ui/aura_shell/test/aura_shell_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698