Bug 1076825 - Don't crash release builds if allocating the buffer on white failed in RotatedBuffer.cpp. r=Bas
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -723,16 +723,22 @@ RotatedContentBuffer::BorrowDrawTargetFo
}
if (result->GetBackendType() == BackendType::DIRECT2D ||
result->GetBackendType() == BackendType::DIRECT2D1_1) {
drawPtr->SimplifyOutwardByArea(100 * 100);
}
if (aPaintState.mMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
MOZ_ASSERT(mDTBuffer && mDTBufferOnWhite);
+ if (!mDTBuffer || !mDTBufferOnWhite) {
+ // This can happen in release builds if allocating one of the two buffers
+ // failed. This is pretty bad and the reason for the failure is already
+ // reported through gfxCriticalError.
+ return nullptr;
+ }
nsIntRegionRectIterator iter(*drawPtr);
const nsIntRect *iterRect;
while ((iterRect = iter.Next())) {
mDTBuffer->FillRect(Rect(iterRect->x, iterRect->y, iterRect->width, iterRect->height),
ColorPattern(Color(0.0, 0.0, 0.0, 1.0)));
mDTBufferOnWhite->FillRect(Rect(iterRect->x, iterRect->y, iterRect->width, iterRect->height),
ColorPattern(Color(1.0, 1.0, 1.0, 1.0)));
}