Bug 1156058 - Null pointer check. r=jgilbert, a=sledru
authorMilan Sreckovic <milan@mozilla.com>
Fri, 24 Apr 2015 11:21:26 -0700
changeset 260548 013da2859c88
parent 260547 ad098fdd6f81
child 260549 b90caf52b6e2
push id815
push userryanvm@gmail.com
push date2015-05-21 17:19 +0000
treeherdermozilla-release@3ef925962765 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, sledru
bugs1156058
milestone38.0.5
Bug 1156058 - Null pointer check. r=jgilbert, a=sledru
gfx/layers/client/CanvasClient.cpp
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -352,36 +352,37 @@ CanvasClientSharedSurface::Update(gfx::I
   gl->MakeCurrent();
 
   if (aLayer->mGLFrontbuffer) {
     mFront = CloneSurface(aLayer->mGLFrontbuffer.get(), aLayer->mFactory.get());
     if (mFront)
       mFront->Surf()->Fence();
   } else {
     mFront = gl->Screen()->Front();
-    if (!mFront)
-      return;
   }
-  MOZ_ASSERT(mFront);
+  if (!mFront) {
+    gfxCriticalError() << "Invalid canvas front buffer";
+    return;
+  }
 
   // Alright, now sort out the IPC goop.
   SharedSurface* surf = mFront->Surf();
   auto forwarder = GetForwarder();
   auto flags = GetTextureFlags() | TextureFlags::IMMUTABLE;
 
   // Get a TexClient from our surf.
   RefPtr<TextureClient> newTex = TexClientFromShSurf(GetForwarder(), surf, flags);
   if (!newTex) {
     auto manager = aLayer->ClientManager();
     auto shadowForwarder = manager->AsShadowForwarder();
     auto layersBackend = shadowForwarder->GetCompositorBackendType();
 
     newTex = TexClientFromReadback(surf, forwarder, flags, layersBackend);
   }
-  MOZ_ASSERT(newTex);
+
   if (!newTex) {
     // May happen in a release build in case of memory pressure.
     gfxCriticalError() << "Failed to allocate a TextureClient for SharedSurface Canvas. size: " << aSize;
     return;
   }
 
   // Add the new TexClient.
   MOZ_ALWAYS_TRUE( AddTextureClient(newTex) );