Bug 1325172 - unregister agent when nsNPAPI releases it. r=baku

When the global window detroyed, the service would notify agent's callback to mute its volume.
And the nsNSNPAPI's detroy would release the agent, I guess these things would happen in the same time.
So we should check whether the agent exists before calling agent's function.

MozReview-Commit-ID: 7uNmbdOLqxe
This commit is contained in:
Alastor Wu
2016-12-23 15:04:51 +08:00
parent 6851dd2e34
commit ba949e84f3

View File

@@ -1797,11 +1797,13 @@ nsNPAPIPluginInstance::WindowVolumeChanged(float aVolume, bool aMuted)
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "SetMuted failed");
if (mMuted != aMuted) {
mMuted = aMuted;
AudioChannelService::AudibleState audible = aMuted ?
AudioChannelService::AudibleState::eNotAudible :
AudioChannelService::AudibleState::eAudible;
mAudioChannelAgent->NotifyStartedAudible(audible,
AudioChannelService::AudibleChangedReasons::eVolumeChanged);
if (mAudioChannelAgent) {
AudioChannelService::AudibleState audible = aMuted ?
AudioChannelService::AudibleState::eNotAudible :
AudioChannelService::AudibleState::eAudible;
mAudioChannelAgent->NotifyStartedAudible(audible,
AudioChannelService::AudibleChangedReasons::eVolumeChanged);
}
}
return rv;
}