Bug 755546: fix incorrect deletion of the sensor observer list in unregistration of one observer. r=cjones

This commit is contained in:
Cervantes Yu 2012-05-21 18:12:03 +08:00
Родитель d2a38bcf4f
Коммит ab223182e9
1 изменённых файлов: 12 добавлений и 4 удалений

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

@ -461,11 +461,19 @@ UnregisterSensorObserver(SensorType aSensor, ISensorObserver *aObserver) {
AssertMainThread();
observers.RemoveObserver(aObserver);
if(observers.Length() == 0) {
DisableSensorNotifications(aSensor);
delete [] gSensorObservers;
gSensorObservers = nsnull;
if (observers.Length() > 0) {
return;
}
DisableSensorNotifications(aSensor);
// Destroy sSensorObservers only if all observer lists are empty.
for (int i = 0; i < NUM_SENSOR_TYPE; i++) {
if (gSensorObservers[i].Length() > 0) {
return;
}
}
delete [] gSensorObservers;
gSensorObservers = nsnull;
}
void