Bug 676690 - Don't release DataSourceSurface pointers until we have finished accessing the pixels. r=Bas
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 14 Sep 2011 16:16:23 -0700
changeset 78290 75cff72d1ff67752e9d2e9105c3fa0c302f78d0d
parent 78289 2b7306ae2e2c1107e1147fa331408771864586ba
child 78291 76f8759a4bf86c4abe286f8c86ef6b17d41b55a8
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs676690
milestone9.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 676690 - Don't release DataSourceSurface pointers until we have finished accessing the pixels. r=Bas
content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
--- a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
@@ -4093,21 +4093,22 @@ nsCanvasRenderingContext2DAzure::GetImag
   }
 
   IntRect srcReadRect = srcRect.Intersect(destRect);
   IntRect dstWriteRect = srcReadRect;
   dstWriteRect.MoveBy(-x, -y);
 
   PRUint8 *src = aData;
   PRUint32 srcStride = w * 4;
-    
+  
+  RefPtr<DataSourceSurface> readback;
   if (!srcReadRect.IsEmpty()) {
     RefPtr<SourceSurface> snapshot = mTarget->Snapshot();
 
-    RefPtr<DataSourceSurface> readback = snapshot->GetDataSurface();
+    readback = snapshot->GetDataSurface();
 
     srcStride = readback->Stride();
     src = readback->GetData() + srcReadRect.y * srcStride + srcReadRect.x * 4;
   }
 
   // make sure sUnpremultiplyTable has been created
   EnsureUnpremultiplyTable();