Bug 943803. Don't try to forcibly discard an image if we have an existing decoder. r=jmuizelaar
authorTimothy Nikkel <tnikkel@gmail.com>
Thu, 16 Jan 2014 16:45:49 -0600
changeset 163887 5a7ba959a5d17c96101908c48d61b1e2e74bd437
parent 163886 9e9cbc97aa0ad6b60f13707c89c6ede3384854db
child 163888 19cb3daa91a754fadda67fa0843ea0cb23a7991f
push idunknown
push userunknown
push dateunknown
reviewersjmuizelaar
bugs943803
milestone29.0a1
Bug 943803. Don't try to forcibly discard an image if we have an existing decoder. r=jmuizelaar
image/src/RasterImage.cpp
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -2596,17 +2596,17 @@ RasterImage::Draw(gfxContext *aContext,
   // we don't currently.)
   if ((aFlags & DECODE_FLAGS_MASK) != DECODE_FLAGS_DEFAULT)
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG_POINTER(aContext);
 
   // We can only draw with the default decode flags
   if (mFrameDecodeFlags != DECODE_FLAGS_DEFAULT) {
-    if (!CanForciblyDiscard())
+    if (!CanForciblyDiscard() || mDecoder || mAnim)
       return NS_ERROR_NOT_AVAILABLE;
     ForceDiscard();
 
     mFrameDecodeFlags = DECODE_FLAGS_DEFAULT;
   }
 
   // If this image is a candidate for discarding, reset its position in the
   // discard tracker so we're less likely to discard it right away.
@@ -2719,17 +2719,17 @@ RasterImage::UnlockImage()
   return NS_OK;
 }
 
 //******************************************************************************
 /* void requestDiscard() */
 NS_IMETHODIMP
 RasterImage::RequestDiscard()
 {
-  if (CanDiscard()) {
+  if (CanDiscard() && !mDecoder && !mAnim) {
     ForceDiscard();
   }
 
   return NS_OK;
 }
 
 // Flushes up to aMaxBytes to the decoder.
 nsresult