Bug 1268155 - GetAsSourceSurface might return nullptr, let's handle it. r=jgilbert a=ritu
authorMorris Tseng <mtseng@mozilla.com>
Thu, 12 May 2016 14:08:24 +0800
changeset 334904 520c41cefb4221f0402b4d10cda5ace5fd792a3c
parent 334903 ef7602300e893e99b112dbd3ce3e562bbeb7cec8
child 334905 4f1d54f271cef800c79dd2dc6494d6ed081c09ab
push id1146
push userCallek@gmail.com
push dateMon, 25 Jul 2016 16:35:44 +0000
treeherdermozilla-release@a55778f9cd5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, ritu
bugs1268155
milestone48.0a2
Bug 1268155 - GetAsSourceSurface might return nullptr, let's handle it. r=jgilbert a=ritu MozReview-Commit-ID: 6uH9esA2PqC
dom/canvas/TexUnpackBlob.cpp
--- a/dom/canvas/TexUnpackBlob.cpp
+++ b/dom/canvas/TexUnpackBlob.cpp
@@ -306,17 +306,23 @@ TexUnpackImage::TexOrSubImage(bool isSub
                                                       dstOrigin))
         {
             break;
         }
 
         return; // Blitting was successful, so we're done!
     } while (false);
 
-    TexUnpackSurface surfBlob(mImage->GetAsSourceSurface(), mIsAlphaPremult);
+    RefPtr<SourceSurface> surface = mImage->GetAsSourceSurface();
+    if (!surface) {
+        *out_glError = LOCAL_GL_OUT_OF_MEMORY;
+        return;
+    }
+
+    TexUnpackSurface surfBlob(surface, mIsAlphaPremult);
 
     surfBlob.TexOrSubImage(isSubImage, needsRespec, funcName, tex, target, level, dui,
                            xOffset, yOffset, zOffset, out_glError);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////
 // TexUnpackSurface