diff --git a/gfx/src/thebes/nsThebesDeviceContext.cpp b/gfx/src/thebes/nsThebesDeviceContext.cpp index d09183772250..a16fd9c8aafd 100644 --- a/gfx/src/thebes/nsThebesDeviceContext.cpp +++ b/gfx/src/thebes/nsThebesDeviceContext.cpp @@ -321,6 +321,9 @@ nsThebesDeviceContext::CreateRenderingContext(nsIWidget *aWidget, nsRefPtr surface(aWidget->GetThebesSurface()); if (surface) rv = pContext->Init(this, surface); + else + rv = NS_ERROR_FAILURE; + if (NS_SUCCEEDED(rv)) { aContext = pContext; NS_ADDREF(aContext); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 1c86d4a45e7e..b62a15115744 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -3410,7 +3410,9 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame, } *aResult = result; - result->Translate(offset.x, offset.y); + if (NS_SUCCEEDED(rv)) { + result->Translate(offset.x, offset.y); + } return rv; } diff --git a/layout/inspector/src/inFlasher.cpp b/layout/inspector/src/inFlasher.cpp index 7b702a5ce83e..deb83d37ee74 100644 --- a/layout/inspector/src/inFlasher.cpp +++ b/layout/inspector/src/inFlasher.cpp @@ -160,9 +160,11 @@ inFlasher::DrawElementOutline(nsIDOMElement* aElement) while (frame) { nsCOMPtr rcontext; - presShell->CreateRenderingContext(frame, getter_AddRefs(rcontext)); - nsRect rect(nsPoint(0,0), frame->GetSize()); + nsresult rv = + presShell->CreateRenderingContext(frame, getter_AddRefs(rcontext)); + NS_ENSURE_SUCCESS(rv, rv); + nsRect rect(nsPoint(0,0), frame->GetSize()); if (mInvert) { rcontext->InvertRect(rect); } diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm index 3ec6cd67c419..5caf89cd123c 100644 --- a/widget/src/cocoa/nsChildView.mm +++ b/widget/src/cocoa/nsChildView.mm @@ -1740,9 +1740,9 @@ nsChildView::Idle() gfxASurface* nsChildView::GetThebesSurface() { - if (!mTempThebesSurface) { mTempThebesSurface = new gfxQuartzSurface(gfxSize(1, 1), gfxASurface::ImageFormatARGB32); + NS_ENSURE_TRUE(mTempThebesSurface.get(), nsnull); // OOM } gfxASurface *surf = mTempThebesSurface.get();