Bug 738102 - devicemotion causes shutdown crash. r=jdm
authorDoug Turner <dougt@dougt.org>
Wed, 21 Mar 2012 22:27:51 -0700
changeset 90025 41f85ded0197c8cf5af119fe31edc7dbec336cb4
parent 90024 46baca135a4c2c9530500880d03d19fc28e7cc05
child 90026 1a0a9c190dd928449f191ebb81346f2c941dae78
push id22308
push usermak77@bonardo.net
push dateFri, 23 Mar 2012 01:00:29 +0000
treeherdermozilla-central@70ac5065caee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs738102
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 738102 - devicemotion causes shutdown crash. r=jdm
hal/cocoa/CocoaSensor.mm
--- a/hal/cocoa/CocoaSensor.mm
+++ b/hal/cocoa/CocoaSensor.mm
@@ -28,33 +28,41 @@ void UpdateHandler(nsITimer *aTimer, voi
   hal::SensorData sdata(hal::SENSOR_ACCELERATION,
 			PR_Now(),
 			values,
 			hal::SENSOR_ACCURACY_UNKNOWN);
   hal::NotifySensorChange(sdata);
 }
 
 void
-EnableSensorNotifications(SensorType aSensor) {
+EnableSensorNotifications(SensorType aSensor)
+{
+  if (aSensor != SENSOR_ACCELERATION)
+    return;
+
   if (sUpdateTimer)
     return;
 
   smsStartup(nil, nil);
   smsLoadCalibration();
 
   CallCreateInstance("@mozilla.org/timer;1", &sUpdateTimer);
   if (sUpdateTimer)
     sUpdateTimer->InitWithFuncCallback(UpdateHandler,
                                        NULL,
                                        DEFAULT_SENSOR_POLL,
                                        nsITimer::TYPE_REPEATING_SLACK);
 }
 
 void
-DisableSensorNotifications(SensorType aSensor) {
+DisableSensorNotifications(SensorType aSensor)
+{
+  if (aSensor != SENSOR_ACCELERATION)
+    return;
+
   if (sUpdateTimer) {
     sUpdateTimer->Cancel();
     NS_RELEASE(sUpdateTimer);
   }
   smsShutdown();
 }
 
 } // hal_impl