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