From 50dfa6485ba2846de19ccb19bda0872ced920e17 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Mon, 17 Oct 2011 13:11:00 +0100 Subject: Fix crash in ImageBufferAndroid. In the case that we do not have sufficient free memory to create a copy of a bitmap, we must return an Image wrapping an empty bitmap, rather than null itself. This handling is particular (but not exclusive) to Android, where we cannot pass a null NativeImagePtr like some other platforms do (as we need it to be valid in the BitmapImage constructor). Bug:5409973 Change-Id: I888cf1db73a9176db2a3ea2721ca0e258d9c7773 --- Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Source/WebCore/platform') diff --git a/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp b/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp index bbde998..691fbca 100644 --- a/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp @@ -85,11 +85,9 @@ PassRefPtr ImageBuffer::copyImage() const SkDevice* device = canvas->getDevice(); const SkBitmap& orig = device->accessBitmap(false); - if (!PlatformBridge::canSatisfyMemoryAllocation(orig.getSize())) - return 0; - SkBitmap copy; - orig.copyTo(©, orig.config()); + if (PlatformBridge::canSatisfyMemoryAllocation(orig.getSize())) + orig.copyTo(©, orig.config()); SkBitmapRef* ref = new SkBitmapRef(copy); RefPtr image = BitmapImage::create(ref, 0); -- cgit v1.1