Bug 1256045 - Add a null-check in BufferTextureHost::EnsureWrappingTextureSource. r=jnicol
☠☠ backed out by 976994a6955b ☠ ☠
authorNicolas Silva <nsilva@mozilla.com>
Thu, 17 Mar 2016 14:59:12 +0100
changeset 289280 1e6a9b36ed358fdba3423833f4bec5074c3cc67e
parent 289279 7a74257343be9ee6eca05026220ed2416f4b5c88
child 289281 4ba52b16f83a45d0d3531185fd4813ec0cd5672e
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjnicol
bugs1256045
milestone48.0a1
Bug 1256045 - Add a null-check in BufferTextureHost::EnsureWrappingTextureSource. r=jnicol
gfx/layers/composite/TextureHost.cpp
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -511,16 +511,26 @@ BufferTextureHost::EnsureWrappingTexture
     gfx::Factory::CreateWrappingDataSourceSurface(GetBuffer(),
       ImageDataSerializer::ComputeRGBStride(mFormat, mSize.width), mSize, mFormat);
 
   if (!surf) {
     return false;
   }
 
   mFirstSource = mCompositor->CreateDataTextureSourceAround(surf);
+  if (!mFirstSource) {
+    // BasicCompositor::CreateDataTextureSourceAround never returns null
+    // and we don't expect to take this branch if we are using another backend.
+    // Returning false is fine but if we get into this situation it probably
+    // means something fishy is going on, like a texture being used with
+    // several compositor backends.
+    NS_WARNING("Failed to use a BufferTextureHost without intermediate buffer");
+    return false;
+  }
+
   mFirstSource->SetUpdateSerial(mUpdateSerial);
   mFirstSource->SetOwner(this);
 
   return true;
 }
 
 void
 BufferTextureHost::PrepareTextureSource(CompositableTextureSourceRef& aTexture)