mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-10 13:54:27 +00:00
Bug 453480 - Detect OOM before creating a thebes img. r=vlad, sr=stuart
This commit is contained in:
parent
cbf953fa8c
commit
6eb295f797
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user