Bug 737462 - nsDeviceMotion leaks hal observers. r=mwu

This commit is contained in:
Doug Turner 2012-03-20 14:50:55 -07:00
parent f9ae7a37f3
commit 20a9ae5e15
2 changed files with 6 additions and 1 deletions

View File

@ -140,6 +140,9 @@ nsDeviceMotion::nsDeviceMotion()
nsDeviceMotion::~nsDeviceMotion()
{
if (mStarted)
Shutdown();
if (mTimeoutTimer)
mTimeoutTimer->Cancel();
}

View File

@ -415,7 +415,7 @@ DisableSensorNotifications(SensorType aSensor) {
}
typedef mozilla::ObserverList<SensorData> SensorObserverList;
static SensorObserverList *gSensorObservers = NULL;
static SensorObserverList* gSensorObservers = NULL;
static SensorObserverList &
GetSensorObservers(SensorType sensor_type) {
@ -447,6 +447,8 @@ UnregisterSensorObserver(SensorType aSensor, ISensorObserver *aObserver) {
observers.RemoveObserver(aObserver);
if(observers.Length() == 0) {
DisableSensorNotifications(aSensor);
delete [] gSensorObservers;
gSensorObservers = nsnull;
}
}