Bug 802144 - Don't delete memory used for image frames while the decoder could still try to use it. r=joe
authorJosh Matthews <josh@joshmatthews.net>
Tue, 16 Oct 2012 22:45:14 -0400
changeset 110484 f8e8868022316daaebb834879d01f78061710894
parent 110483 16adea14324fcb0ee3f255cbec28e01565a39026
child 110485 7a8f277d19dfb6a98980f7698beb412a0078c6ae
push id16575
push userjosh@joshmatthews.net
push dateWed, 17 Oct 2012 02:45:21 +0000
treeherdermozilla-inbound@f8e886802231 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjoe
bugs802144
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 802144 - Don't delete memory used for image frames while the decoder could still try to use it. r=joe
image/src/RasterImage.cpp
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -247,22 +247,16 @@ RasterImage::RasterImage(imgStatusTracke
 
 }
 
 //******************************************************************************
 RasterImage::~RasterImage()
 {
   ScaleRequest::Stop(mScaleRequest.image);
 
-  delete mAnim;
-
-  for (unsigned int i = 0; i < mFrames.Length(); ++i)
-    delete mFrames[i];
-  mFrames.Clear();
-
   // Discardable statistics
   if (mDiscardable) {
     num_discardable_containers--;
     discardable_source_bytes -= mSourceData.Length();
 
     PR_LOG (gCompressedImageAccountingLog, PR_LOG_DEBUG,
             ("CompressedImageAccounting: destroying RasterImage %p.  "
              "Total Containers: %d, Discardable containers: %d, "
@@ -277,16 +271,21 @@ RasterImage::~RasterImage()
 
   // If we have a decoder open, shut it down
   if (mDecoder) {
     nsresult rv = ShutdownDecoder(eShutdownIntent_Interrupted);
     if (NS_FAILED(rv))
       NS_WARNING("Failed to shut down decoder in destructor!");
   }
 
+  delete mAnim;
+
+  for (unsigned int i = 0; i < mFrames.Length(); ++i)
+    delete mFrames[i];
+
   // Total statistics
   num_containers--;
   total_source_bytes -= mSourceData.Length();
 }
 
 void
 RasterImage::Initialize()
 {