Bug 737462 - nsDeviceMotion leaks hal observers. r=mwu

This commit is contained in:
Doug Turner 2012-03-20 14:50:55 -07:00
Родитель 1ee5aed0ed
Коммит 23746e5ebc
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

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

Просмотреть файл

@ -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;
}
}