summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-26 04:09:39 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-26 04:09:39 +0000
commit8d7a161251be5efbce8712c028c7934291b38bb4 (patch)
tree5583b2996cb4b0f62137a4ecc7032cce03f727cf /ash
parent2381ed2ed0e7560a29fe484d6c79103ca8eafa12 (diff)
downloadchromium_src-8d7a161251be5efbce8712c028c7934291b38bb4.zip
chromium_src-8d7a161251be5efbce8712c028c7934291b38bb4.tar.gz
chromium_src-8d7a161251be5efbce8712c028c7934291b38bb4.tar.bz2
aura: Handle NULL |container| case in GetTopmostWindowToActivate
When shell shutdown starts, if the active window is in a container that gets destructed after the default container (e.g. status area widget, full screen bubble), GetTopmostWindowToActivate will be called when destructing this active window. However, GetContainer(kShellWindowId_DefaultContainer) would return NULL because default container is already destructed at this point. Add a NULL check to avoid the crash. BUG=110916 TEST=Verify the crash in issue 110916 no longer happens. Review URL: http://codereview.chromium.org/9169058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119190 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/wm/activation_controller.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/ash/wm/activation_controller.cc b/ash/wm/activation_controller.cc
index 8f4e801..dda4b75 100644
--- a/ash/wm/activation_controller.cc
+++ b/ash/wm/activation_controller.cc
@@ -209,12 +209,17 @@ aura::Window* ActivationController::GetTopmostWindowToActivate(
const aura::Window* container =
default_container_for_test_ ? default_container_for_test_ :
GetContainer(kShellWindowId_DefaultContainer);
- for (aura::Window::Windows::const_reverse_iterator i =
- container->children().rbegin();
- i != container->children().rend();
- ++i) {
- if (*i != ignore && CanActivateWindow(*i))
- return *i;
+ // When destructing an active window that is in a container destructed after
+ // the default container during shell shutdown, |container| would be NULL
+ // because default container is destructed at this point.
+ if (container) {
+ for (aura::Window::Windows::const_reverse_iterator i =
+ container->children().rbegin();
+ i != container->children().rend();
+ ++i) {
+ if (*i != ignore && CanActivateWindow(*i))
+ return *i;
+ }
}
return NULL;
}