diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-03 01:07:15 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-03 01:07:15 +0000 |
commit | ef589afc44a9ce7ccedb1948eace1f2fbfe7ec49 (patch) | |
tree | cfcff5b66e29903686b29c2d41e48ca2d0c560fd /ui | |
parent | ede5e61adaed9fb0c553161a075e4ee327cd4cae (diff) | |
download | chromium_src-ef589afc44a9ce7ccedb1948eace1f2fbfe7ec49.zip chromium_src-ef589afc44a9ce7ccedb1948eace1f2fbfe7ec49.tar.gz chromium_src-ef589afc44a9ce7ccedb1948eace1f2fbfe7ec49.tar.bz2 |
Delete desktop/shell instance correctly upon shutdown.
* Moved parts->PostMainMessageLoopRun call from PostDestroyThreads to the right place (PostMainMessageLoopRun() method)
* Renamed Shell::DeleteInstanceForTesting to DeleteInstance as this is no longer for testing.
BUG=106070
TEST=browser_tests on aura will not crash as described in the bug
Review URL: http://codereview.chromium.org/8774029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112836 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/desktop_host_linux.cc | 2 | ||||
-rw-r--r-- | ui/aura_shell/shelf_layout_controller.cc | 3 | ||||
-rw-r--r-- | ui/aura_shell/shell.cc | 21 | ||||
-rw-r--r-- | ui/aura_shell/shell.h | 2 | ||||
-rw-r--r-- | ui/aura_shell/test/aura_shell_test_base.cc | 2 | ||||
-rw-r--r-- | ui/views/widget/native_widget_aura.cc | 6 |
6 files changed, 24 insertions, 12 deletions
diff --git a/ui/aura/desktop_host_linux.cc b/ui/aura/desktop_host_linux.cc index edf0b2d..6025de5 100644 --- a/ui/aura/desktop_host_linux.cc +++ b/ui/aura/desktop_host_linux.cc @@ -592,7 +592,7 @@ void DesktopHostLinux::PostNativeEvent(const base::NativeEvent& native_event) { } void DesktopHostLinux::WillDestroyCurrentMessageLoop() { - desktop_->DeleteInstance(); + aura::Desktop::DeleteInstance(); } bool DesktopHostLinux::IsWindowManagerPresent() { diff --git a/ui/aura_shell/shelf_layout_controller.cc b/ui/aura_shell/shelf_layout_controller.cc index 7e7f851..d26af3c 100644 --- a/ui/aura_shell/shelf_layout_controller.cc +++ b/ui/aura_shell/shelf_layout_controller.cc @@ -35,7 +35,8 @@ ShelfLayoutController::ShelfLayoutController(views::Widget* launcher, } ShelfLayoutController::~ShelfLayoutController() { - GetLayer(launcher_)->GetAnimator()->RemoveObserver(this); + // Do not try to remove observer from layer as the Launcher is + // already deleted. } void ShelfLayoutController::LayoutShelf() { diff --git a/ui/aura_shell/shell.cc b/ui/aura_shell/shell.cc index 32c84bd..ded7967 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; } diff --git a/ui/aura_shell/shell.h b/ui/aura_shell/shell.h index 53a3c3b..ae5f7c1 100644 --- a/ui/aura_shell/shell.h +++ b/ui/aura_shell/shell.h @@ -54,7 +54,7 @@ class AURA_SHELL_EXPORT Shell { // Should never be called before |CreateInstance()|. static Shell* GetInstance(); - static void DeleteInstanceForTesting(); + static void DeleteInstance(); aura::Window* GetContainer(int container_id); const aura::Window* GetContainer(int container_id) const; diff --git a/ui/aura_shell/test/aura_shell_test_base.cc b/ui/aura_shell/test/aura_shell_test_base.cc index fe121f2..3fe7ebd 100644 --- a/ui/aura_shell/test/aura_shell_test_base.cc +++ b/ui/aura_shell/test/aura_shell_test_base.cc @@ -27,7 +27,7 @@ void AuraShellTestBase::TearDown() { RunAllPendingInMessageLoop(); // Tear down the shell. - aura_shell::Shell::DeleteInstanceForTesting(); + aura_shell::Shell::DeleteInstance(); aura::test::AuraTestBase::TearDown(); } diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index 8308a45..26d3392 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -372,10 +372,10 @@ void NativeWidgetAura::Close() { // and ownership is WIDGET_OWNS_NATIVE_WIDGET. DCHECK(window_ || ownership_ == Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET); - if (window_) + if (window_) { Hide(); - - window_->SetIntProperty(aura::kModalKey, 0); + window_->SetIntProperty(aura::kModalKey, 0); + } if (!close_widget_factory_.HasWeakPtrs()) { MessageLoop::current()->PostTask( |