Bug 1248276: getStagingStorage could return null. Wallpaper, speculative fix. r?jrmuizel draft
authorMilan Sreckovic <milan@mozilla.com>
Wed, 23 Mar 2016 10:57:11 -0400
changeset 343922 2119b0038e5d51222f04ef69ce71b0168ef487d6
parent 343808 efe7d026ac641759838dd3897c37892e37e5b244
child 516850 8d0d06d5fdc60cd9f9b5ec8e5a78bed995401a89
push id13709
push usermsreckovic@mozilla.com
push dateWed, 23 Mar 2016 14:58:18 +0000
reviewersjrmuizel
bugs1248276
milestone48.0a1
Bug 1248276: getStagingStorage could return null. Wallpaper, speculative fix. r?jrmuizel MozReview-Commit-ID: GYSrJI94rCQ
gfx/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
@@ -767,16 +767,21 @@ void Buffer11::updateBufferStorage(Buffe
         // Copy through a staging buffer if we're copying from or to a non-staging, mappable
         // buffer storage. This is because we can't map a GPU buffer, and copy CPU
         // data directly. If we're already using a staging buffer we're fine.
         if (latestBuffer->getUsage() != BUFFER_USAGE_STAGING &&
             storage->getUsage() != BUFFER_USAGE_STAGING &&
             (!latestBuffer->isMappable() || !storage->isMappable()))
         {
             NativeStorage *stagingBuffer = getStagingStorage();
+            if (!stagingBuffer)
+            {
+		// gl::Error(GL_OUT_OF_MEMORY, "Failed to allocate internal buffer.");
+                return;
+            }
 
             stagingBuffer->copyFromStorage(latestBuffer, 0, latestBuffer->getSize(), 0);
             stagingBuffer->setDataRevision(latestBuffer->getDataRevision());
 
             latestBuffer = stagingBuffer;
         }
 
         // if copyFromStorage returns true, the D3D buffer has been recreated