mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-08 12:22:34 +00:00
Bug 1387058 - part1: Clear the static pointer when no more AudioStreams; r=jwwang
--HG-- extra : rebase_source : 24afc6aa73cdba9340d9678ea45a9aa9265daa75
This commit is contained in:
parent
45c3a7524e
commit
bb2563e5f9
@ -54,6 +54,10 @@ AudioNotificationReceiver::Unregister(AudioStream* aAudioStream)
|
||||
MOZ_ASSERT(!sSubscribers->IsEmpty(), "No subscriber.");
|
||||
|
||||
sSubscribers->RemoveElement(aAudioStream);
|
||||
if (sSubscribers->IsEmpty()) {
|
||||
// Clear the static pointer here to prevent memory leak.
|
||||
sSubscribers = nullptr;
|
||||
}
|
||||
|
||||
ANR_LOG("The AudioStream: %p is unregistered successfully.", aAudioStream);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user