Bug 790503 - On Mac Mini, defaultCalibration reads outside of sensors[]. r=jruderman@gmail.com,blassey
authorDoug Turner <dougt@dougt.org>
Mon, 01 Oct 2012 20:45:32 -0700
changeset 108859 bae96aa5f1adb4c04801db0ad7bd71569c026830
parent 108858 ba388025ede9aa7321034c903fc36002ba791e87
child 108860 2575a2f89d22c5b2a1d5e76c85c270d5314f88c6
push id23596
push useremorley@mozilla.com
push dateTue, 02 Oct 2012 15:53:55 +0000
treeherdermozilla-central@345a2a8ccb18 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjruderman
bugs790503
milestone18.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 790503 - On Mac Mini, defaultCalibration reads outside of sensors[]. r=jruderman@gmail.com,blassey
hal/cocoa/CocoaSensor.mm
--- a/hal/cocoa/CocoaSensor.mm
+++ b/hal/cocoa/CocoaSensor.mm
@@ -36,18 +36,24 @@ void
 EnableSensorNotifications(SensorType aSensor)
 {
   if (aSensor != SENSOR_ACCELERATION)
     return;
 
   if (sUpdateTimer)
     return;
 
-  smsStartup(nil, nil);
-  smsLoadCalibration();
+  int result = smsStartup(nil, nil);
+  if (result != SMS_SUCCESS) {
+    return;
+  }
+
+  if (!smsLoadCalibration()) {
+    return;
+  }
 
   CallCreateInstance("@mozilla.org/timer;1", &sUpdateTimer);
   if (sUpdateTimer)
     sUpdateTimer->InitWithFuncCallback(UpdateHandler,
                                        NULL,
                                        DEFAULT_SENSOR_POLL,
                                        nsITimer::TYPE_REPEATING_SLACK);
 }