Bug 921215 - Handle being passed NULL ptr for either surface or gl to SharedSurface_IOSurface::Create by returning NULL. r=mattwoodrow

This commit is contained in:
Dan Glastonbury 2013-12-03 13:11:27 +10:00
parent d3041f814e
commit 8fcf8f2e03

View File

@ -18,6 +18,9 @@ using namespace gfx;
/* static */ SharedSurface_IOSurface*
SharedSurface_IOSurface::Create(MacIOSurface* surface, GLContext *gl, bool hasAlpha)
{
MOZ_ASSERT(surface);
MOZ_ASSERT(gl);
gfxIntSize size(surface->GetWidth(), surface->GetHeight());
return new SharedSurface_IOSurface(surface, gl, size, hasAlpha);
}
@ -99,6 +102,11 @@ SurfaceFactory_IOSurface::CreateShared(const gfxIntSize& size)
RefPtr<MacIOSurface> surf =
MacIOSurface::CreateIOSurface(size.width, size.height, 1.0, hasAlpha);
if (!surf) {
NS_WARNING("Failed to create MacIOSurface.");
return nullptr;
}
return SharedSurface_IOSurface::Create(surf, mGL, hasAlpha);
}