Bug 1343851 - Add nullptr check for SurfaceFactory in StartVRPresentation. r=mtseng, a=jcristau
authorvincentliu <vliu@mozilla.com>
Fri, 10 Mar 2017 09:30:49 +0800
changeset 355462 e104d53316d73519b8400e1bcd2372fd0325ed31
parent 355461 5dec7534760fa16beefc291e2ba5466b8421c82b
child 355463 864644fadcb098c05415fa39a1a8b5c390f3a53a
push id6981
push userryanvm@gmail.com
push dateMon, 27 Mar 2017 21:21:40 +0000
treeherdermozilla-esr52@795a3d48a775 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmtseng, jcristau
bugs1343851
milestone52.0.2
Bug 1343851 - Add nullptr check for SurfaceFactory in StartVRPresentation. r=mtseng, a=jcristau
dom/canvas/WebGLContext.cpp
gfx/gl/GLScreenBuffer.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -2340,17 +2340,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);