diff --git a/dom/bluetooth/BluetoothService.cpp b/dom/bluetooth/BluetoothService.cpp index 3afe51a4d64f..7c186f90614b 100644 --- a/dom/bluetooth/BluetoothService.cpp +++ b/dom/bluetooth/BluetoothService.cpp @@ -358,13 +358,22 @@ BluetoothService::UnregisterBluetoothSignalHandler( } } +PLDHashOperator +RemoveAllSignalHandlers(const nsAString& aKey, + nsAutoPtr& aData, + void* aUserArg) +{ + aData->RemoveObserver(static_cast(aUserArg)); + return aData->Length() ? PL_DHASH_NEXT : PL_DHASH_REMOVE; +} + void BluetoothService::UnregisterAllSignalHandlers(BluetoothSignalObserver* aHandler) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aHandler); - mBluetoothSignalObserverTable.Clear(); + mBluetoothSignalObserverTable.Enumerate(RemoveAllSignalHandlers, aHandler); } void