Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3364)

Unified Diff: ash/system/chromeos/power/tablet_power_button_controller.cc

Issue 2645523004: mash: Fix TabletPowerButtonController segfault. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/chromeos/power/tablet_power_button_controller.cc
diff --git a/ash/system/chromeos/power/tablet_power_button_controller.cc b/ash/system/chromeos/power/tablet_power_button_controller.cc
index aba3b6cca4f4df6d1cdc6e0079d7c74d8dc6deec..70176746bde652c1bf09b36defbf9cb0e8bc6cd9 100644
--- a/ash/system/chromeos/power/tablet_power_button_controller.cc
+++ b/ash/system/chromeos/power/tablet_power_button_controller.cc
@@ -87,7 +87,10 @@ TabletPowerButtonController::TabletPowerButtonController(
chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(
this);
WmShell::Get()->AddShellObserver(this);
- ui::InputDeviceManager::GetInstance()->AddObserver(this);
+ // TODO(mash): Provide a way for this class to observe stylus events:
+ // http://crbug.com/682460
+ if (ui::InputDeviceManager::HasInstance())
+ ui::InputDeviceManager::GetInstance()->AddObserver(this);
Shell::GetInstance()->PrependPreTargetHandler(this);
GetInitialBacklightsForcedOff();
@@ -95,7 +98,8 @@ TabletPowerButtonController::TabletPowerButtonController(
TabletPowerButtonController::~TabletPowerButtonController() {
Shell::GetInstance()->RemovePreTargetHandler(this);
- ui::InputDeviceManager::GetInstance()->RemoveObserver(this);
+ if (ui::InputDeviceManager::HasInstance())
+ ui::InputDeviceManager::GetInstance()->RemoveObserver(this);
WmShell::Get()->RemoveShellObserver(this);
chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(
this);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698