Fixes crash in ShelfLayoutManager that would occur when closing window
with a full screen window. The problem was we deleted the launcher
and left other objects around so that if one of those other objects
needed the launcher we would crash.

BUG=110205
TEST=covered by unit tests.
[email protected]


Review URL: http://codereview.chromium.org/9133017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117906 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ash/wm/shelf_layout_manager.cc b/ash/wm/shelf_layout_manager.cc
index 87b9d6c8..fd55b1b9 100644
--- a/ash/wm/shelf_layout_manager.cc
+++ b/ash/wm/shelf_layout_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -42,8 +42,7 @@
 }
 
 ShelfLayoutManager::~ShelfLayoutManager() {
-  // Do not try to remove observer from layer as the Launcher is
-  // already deleted.
+  GetLayer(launcher_)->GetAnimator()->RemoveObserver(this);
 }
 
 void ShelfLayoutManager::LayoutShelf() {