Remove observers from SystemTrayNotifier on destruction

[email protected]
BUG=145978
TEST=none


Review URL: https://chromiumcodereview.appspot.com/11515004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172227 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ash/shell.cc b/ash/shell.cc
index a6e4ee0..dbf94c24 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -258,14 +258,13 @@
   // Destroy SystemTrayDelegate before destroying the status area(s).
   system_tray_delegate_.reset();
 
-  // Destroy SystemTrayNotifier immediately after destroying SystemTrayDelegate
-  // so that it is still available when shutting down the UI, but not after
-  // the notifier observers have been destroyed.
-  system_tray_notifier_.reset();
-
   // Destroy all child windows including widgets.
   display_controller_->CloseChildWindows();
 
+  // Destroy SystemTrayNotifier after destroying SystemTray as TrayItems
+  // needs to remove observers from it.
+  system_tray_notifier_.reset();
+
   // These need a valid Shell instance to clean up properly, so explicitly
   // delete them before invalidating the instance.
   // Alphabetical.