Bug 453480 - Detect OOM before creating a thebes img. r=vlad, sr=stuart

This commit is contained in:
Doug Turner 2008-09-03 16:07:36 -07:00
parent cbf953fa8c
commit 6eb295f797

View File

@ -92,6 +92,17 @@ nsThebesImage::Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, nsMaskRequi
if (!AllowedImageSize(aWidth, aHeight))
return NS_ERROR_FAILURE;
// Check to see if we are running OOM
nsCOMPtr<nsIMemory> mem;
NS_GetMemoryManager(getter_AddRefs(mem));
if (!mem)
return NS_ERROR_UNEXPECTED;
PRBool lowMemory;
mem->IsLowMemory(&lowMemory);
if (lowMemory)
return NS_ERROR_OUT_OF_MEMORY;
gfxImageSurface::gfxImageFormat format;
switch(aMaskRequirements)
{