summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLincoln Ramsay <lincoln.ramsay@nokia.com>2011-04-08 12:38:51 +1000
committerLincoln Ramsay <lincoln.ramsay@nokia.com>2011-04-08 12:49:38 +1000
commit68c5f6296bb6c756ce9218f3dd1e1fb584b596f6 (patch)
tree0467ed1ea107686420dcb72061d96475eba8b5c1
parent86cd75b03a3ff9217bda4441542e7f1ddc65ad58 (diff)
Fix the compass crash (for real)
The original fix wasn't really one at all. Not sure why it made the issue go away when I tested it. The actual problem is passing NULL to the magnetometer backend. Pass a dummy sensor object instead so that nobody tries to dereference a null pointer.
-rw-r--r--plugins/sensors/symbian/compasssym.cpp3
-rw-r--r--plugins/sensors/symbian/magnetometersensorsym.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/plugins/sensors/symbian/compasssym.cpp b/plugins/sensors/symbian/compasssym.cpp
index 43c88be1ef..216724156e 100644
--- a/plugins/sensors/symbian/compasssym.cpp
+++ b/plugins/sensors/symbian/compasssym.cpp
@@ -137,7 +137,8 @@ void CCompassSym::ConstructL()
InitializeL();
// Create magnetometer, this is required as in sensor server,
// calibration data is available only for magnetometer
- iMagnetometer = CMagnetometerSensorSym::NewL(NULL);
+ // We need to have a QSensor instance for the magnetometer backend or we will crash
+ iMagnetometer = CMagnetometerSensorSym::NewL(new QSensor("QMagnetometer", this));
// Listen only for property change on magnetometer as we are
// interested only in calibration property
iMagnetometer->SetListening(EFalse, ETrue);
diff --git a/plugins/sensors/symbian/magnetometersensorsym.cpp b/plugins/sensors/symbian/magnetometersensorsym.cpp
index 33bb0c2bd1..ea75dfde5f 100644
--- a/plugins/sensors/symbian/magnetometersensorsym.cpp
+++ b/plugins/sensors/symbian/magnetometersensorsym.cpp
@@ -205,7 +205,7 @@ void CMagnetometerSensorSym::ProcessReading()
z = iData.iAxisZRaw;
}
// Scale adjustments
- if(iScaleRange && sensor()->outputRanges().count())
+ if(iScaleRange)
{
qoutputrangelist rangeList = sensor()->outputRanges();
int outputRange = sensor()->outputRange();