Bug 1245959 - Remove MOZ_CRASH from GLImage::GetAsSourceSurface. r=nical, a=ritu
authorJamie Nicol <jnicol@mozilla.com>
Tue, 11 Oct 2016 15:01:08 -0400
changeset 356090 0abdfc79d8e124287f91a75652d542ccaa7a6ca6
parent 356089 0c4ba72824a240db2d161f7d518a0c86d14b2ef6
child 356091 88b6fcb46b5eb3b08ca9afdc1e53d276d758d73a
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical, ritu
Bug 1245959 - Remove MOZ_CRASH from GLImage::GetAsSourceSurface. r=nical, a=ritu We are forcing a crash when we fail to bind a texture to a framebuffer. Although it is not clear why this step is failing, crashing is too drastic an action. Instead, return nullptr as is done for every other possible failure during this function. Also log a gfxCriticalError, which will hopefully allow us to find the cause of the failure at some point, while not crashing for release users. MozReview-Commit-ID: H1RlFz8ZVbU
--- a/gfx/layers/GLImages.cpp
+++ b/gfx/layers/GLImages.cpp
@@ -68,17 +68,18 @@ GLImage::GetAsSourceSurface()
   sSnapshotContext->fTexImage2D(LOCAL_GL_TEXTURE_2D, 0, LOCAL_GL_RGBA,
                                 size.width, size.height, 0,
   ScopedFramebufferForTexture autoFBForTex(sSnapshotContext, scopedTex.Texture());
   if (!autoFBForTex.IsComplete()) {
-      MOZ_CRASH("GFX: ScopedFramebufferForTexture failed.");
+      gfxCriticalError() << "GetAsSourceSurface: ScopedFramebufferForTexture failed.";
+      return nullptr;
   const gl::OriginPos destOrigin = gl::OriginPos::TopLeft;
   if (!sSnapshotContext->BlitHelper()->BlitImageToFramebuffer(this, size,