Bug 831427: Gate RemoveListener(stream) to avoid calling if Destroy() pending r=roc

This commit is contained in:
Randell Jesup 2013-01-17 02:38:21 -05:00
parent c856ab3666
commit db14a79f0f
2 changed files with 6 additions and 1 deletions

View File

@ -306,6 +306,8 @@ MediaEngineWebRTCAudioSource::Process(const int channel,
SourceMediaStream *source = mSources[i];
if (source) {
// This is safe from any thread, and is safe if the track is Finished
// or Destroyed
source->AppendToTrack(mTrackID, &segment);
}
}

View File

@ -125,7 +125,10 @@ public:
if (mStream && !mRemoved) {
MM_LOG(("Listener removed on purpose, mFinished = %d", (int) mFinished));
mRemoved = true; // RemoveListener is async, avoid races
mStream->RemoveListener(this);
// If it's destroyed, don't call - listener will be removed and we'll be notified!
if (!mStream->IsDestroyed()) {
mStream->RemoveListener(this);
}
}
}