Fix a crash in TrayRotationLock::OnRotationLockChanged
commit58a4ca3f3a3b5c2055e3206700373e665f7221ea
authorjonross <jonross@chromium.org>
Fri, 14 Aug 2015 15:20:16 +0000 (14 08:20 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 14 Aug 2015 15:20:53 +0000 (14 15:20 +0000)
tree8a7dd8e22a279c550c53e23113a2b40f02fb4492
parent06c46eef718a03f7d4ca76f1329ca7d420df4642
Fix a crash in TrayRotationLock::OnRotationLockChanged

When the StatusAreaWidget is being shutdown, tray views are deleted before their
owning TrayImageItems.

During this process updates to the rotation lock can cause TrayRotationLock to
attempt to access the now destroyed tray view.

Updated TrayRotationLock to exit OnRotationLockChanged early if there is no tray
view.

TEST=TrayRotationLockTest.LockUpdatedDuringDesctruction
BUG=516498

Review URL: https://codereview.chromium.org/1281903004

Cr-Commit-Position: refs/heads/master@{#343386}
ash/system/chromeos/rotation/tray_rotation_lock.cc
ash/system/chromeos/rotation/tray_rotation_lock.h
ash/system/chromeos/rotation/tray_rotation_lock_unittest.cc