зеркало из https://github.com/mozilla/gecko-dev.git
Bug 755546: fix incorrect deletion of the sensor observer list in unregistration of one observer. r=cjones
This commit is contained in:
Родитель
d2a38bcf4f
Коммит
ab223182e9
16
hal/Hal.cpp
16
hal/Hal.cpp
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче