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 115157 bae96aa5f1adb4c04801db0ad7bd71569c026830
parent 115156 ba388025ede9aa7321034c903fc36002ba791e87
child 115158 2575a2f89d22c5b2a1d5e76c85c270d5314f88c6
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [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);
 }