Bug 1127188 - Null-check the destination in AudioContext::Close, since it can now be called after the graph is dead. r=ehsan

This commit is contained in:
Paul Adenot 2015-05-20 18:47:48 +02:00
Родитель 0ab779951a
Коммит 776849a603
1 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -912,14 +912,18 @@ AudioContext::Close(ErrorResult& aRv)
mCloseCalled = true;
mPromiseGripArray.AppendElement(promise);
Graph()->ApplyAudioContextOperation(DestinationStream()->AsAudioNodeStream(),
AudioContextOperation::Close, promise);
// This can be called when freeing a document, and the streams are dead at
// this point, so we need extra null-checks.
MediaStream* ds = DestinationStream();
if (ds) {
ds->BlockStreamIfNeeded();
}
Graph()->ApplyAudioContextOperation(ds->AsAudioNodeStream(),
AudioContextOperation::Close, promise);
if (ds) {
ds->BlockStreamIfNeeded();
}
}
return promise.forget();
}