Skip to content
Snippets Groups Projects
Commit bb2563e5 authored by Chun-Min Chang's avatar Chun-Min Chang
Browse files

Bug 1387058 - part1: Clear the static pointer when no more AudioStreams; r=jwwang

--HG--
extra : rebase_source : 24afc6aa73cdba9340d9678ea45a9aa9265daa75
parent 45c3a752
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment