Bug 625237 - Always call DecrementAnimationConsumers in nsDocument::RemoveImage. r=bz a=blocking-fennec

This commit is contained in:
Alon Zakai 2011-01-26 10:52:44 -08:00
Родитель 7ae69a27cf
Коммит 75bd8c3d62
1 изменённых файлов: 18 добавлений и 12 удалений

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

@ -8114,22 +8114,24 @@ nsDocument::AddImage(imgIRequest* aImage)
if (!success) if (!success)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = NS_OK;
// If this is the first insertion and we're locking images, lock this image // If this is the first insertion and we're locking images, lock this image
// too. // too.
if ((oldCount == 0) && mLockingImages) { if (oldCount == 0 && mLockingImages) {
nsresult rv = aImage->LockImage(); rv = aImage->LockImage();
NS_ENSURE_SUCCESS(rv, rv); if (NS_SUCCEEDED(rv))
rv = aImage->RequestDecode(); rv = aImage->RequestDecode();
NS_ENSURE_SUCCESS(rv, rv);
} }
// If this is the first insertion and we're animating images, request // If this is the first insertion and we're animating images, request
// that this image be animated too. // that this image be animated too.
if (oldCount == 0 && mAnimatingImages) { if (oldCount == 0 && mAnimatingImages) {
return aImage->IncrementAnimationConsumers(); nsresult rv2 = aImage->IncrementAnimationConsumers();
rv = NS_SUCCEEDED(rv) ? rv2 : rv;
} }
return NS_OK; return rv;
} }
nsresult nsresult
@ -8154,17 +8156,21 @@ nsDocument::RemoveImage(imgIRequest* aImage)
mImageTracker.Put(aImage, count); mImageTracker.Put(aImage, count);
} }
nsresult rv = NS_OK;
// If we removed the image from the tracker and we're locking images, unlock // If we removed the image from the tracker and we're locking images, unlock
// this image. // this image.
if ((count == 0) && mLockingImages) if (count == 0 && mLockingImages)
return aImage->UnlockImage(); rv = aImage->UnlockImage();
// If we removed the image from the tracker and we're animating images, // If we removed the image from the tracker and we're animating images,
// remove our request to animate this image. // remove our request to animate this image.
if (count == 0 && mAnimatingImages) if (count == 0 && mAnimatingImages) {
return aImage->DecrementAnimationConsumers(); nsresult rv2 = aImage->DecrementAnimationConsumers();
rv = NS_SUCCEEDED(rv) ? rv2 : rv;
}
return NS_OK; return rv;
} }
PLDHashOperator LockEnumerator(imgIRequest* aKey, PLDHashOperator LockEnumerator(imgIRequest* aKey,