Bug 1343851 - Add nullptr check for SurfaceFactory in StartVRPresentation. r=mtseng a=gchang
authorvincentliu <vliu@mozilla.com>
Fri, 10 Mar 2017 09:30:49 +0800
changeset 376770 fd0708b8461b5bf331f0335876920d8d3f833976
parent 376769 5d47ea9e922d9cb2f2f289fab56231cad6a0f71b
child 376771 5359d7b1d4cdb6807595d21d8b233f58ec5dd84b
push id7036
push usercbook@mozilla.com
push dateTue, 14 Mar 2017 15:55:36 +0000
treeherdermozilla-beta@fd0708b8461b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmtseng, gchang
bugs1343851
milestone53.0
Bug 1343851 - Add nullptr check for SurfaceFactory in StartVRPresentation. r=mtseng a=gchang
dom/canvas/WebGLContext.cpp
gfx/gl/GLScreenBuffer.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -2342,17 +2342,19 @@ WebGLContext::StartVRPresentation()
 
     UniquePtr<gl::SurfaceFactory> factory =
         gl::GLScreenBuffer::CreateFactory(gl,
             caps,
             vrmc,
             vrmc->GetBackendType(),
             TextureFlags::ORIGIN_BOTTOM_LEFT);
 
-    screen->Morph(Move(factory));
+    if (factory) {
+        screen->Morph(Move(factory));
+    }
     return true;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
 static inline size_t
 SizeOfViewElem(const dom::ArrayBufferView& view)
 {
--- a/gfx/gl/GLScreenBuffer.cpp
+++ b/gfx/gl/GLScreenBuffer.cpp
@@ -466,17 +466,17 @@ GLScreenBuffer::AssureBlitted()
     }
 
     mNeedsBlit = false;
 }
 
 void
 GLScreenBuffer::Morph(UniquePtr<SurfaceFactory> newFactory)
 {
-    MOZ_ASSERT(newFactory);
+    MOZ_RELEASE_ASSERT(newFactory, "newFactory must not be null");
     mFactory = Move(newFactory);
 }
 
 bool
 GLScreenBuffer::Attach(SharedSurface* surf, const gfx::IntSize& size)
 {
     ScopedBindFramebuffer autoFB(mGL);