зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1442037 - Fix an incorrect assert in DecoderFactory::CloneAnimationDecoder. r=tnikkel
When cloning an animated image decoder, we asserted that Decoder::HasAnimation was true. This is incorrect because if the decoder has yet to complete the metadata decoding, or it has but only finds out the image is animated when it discovers the second frame, then we will try to clone a valid animated image decoder, but fail the assertion. Instead, this patch verifies the image type supports animations.
This commit is contained in:
Родитель
32939c5d14
Коммит
bd5718ece1
|
@ -229,10 +229,16 @@ DecoderFactory::CreateAnimationDecoder(DecoderType aType,
|
|||
DecoderFactory::CloneAnimationDecoder(Decoder* aDecoder)
|
||||
{
|
||||
MOZ_ASSERT(aDecoder);
|
||||
MOZ_ASSERT(aDecoder->HasAnimation());
|
||||
|
||||
RefPtr<Decoder> decoder = GetDecoder(aDecoder->GetType(), nullptr,
|
||||
/* aIsRedecode = */ true);
|
||||
// In an ideal world, we would assert aDecoder->HasAnimation() but we cannot.
|
||||
// The decoder may not have detected it is animated yet (e.g. it did not even
|
||||
// get scheduled yet, or it has only decoded the first frame and has yet to
|
||||
// rediscover it is animated).
|
||||
DecoderType type = aDecoder->GetType();
|
||||
MOZ_ASSERT(type == DecoderType::GIF || type == DecoderType::PNG,
|
||||
"Calling CloneAnimationDecoder for non-animating DecoderType");
|
||||
|
||||
RefPtr<Decoder> decoder = GetDecoder(type, nullptr, /* aIsRedecode = */ true);
|
||||
MOZ_ASSERT(decoder, "Should have a decoder now");
|
||||
|
||||
// Initialize the decoder.
|
||||
|
|
Загрузка…
Ссылка в новой задаче