mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 998130 - Add null checks in CairoImage::GetTextureClient. r=bjacob
This commit is contained in:
parent
a700e6ab19
commit
e79eddc24f
@ -613,6 +613,10 @@ CairoImage::~CairoImage()
|
||||
TextureClient*
|
||||
CairoImage::GetTextureClient(CompositableClient *aClient)
|
||||
{
|
||||
if (!aClient) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CompositableForwarder* forwarder = aClient->GetForwarder();
|
||||
RefPtr<TextureClient> textureClient = mTextureClients.Get(forwarder->GetSerial());
|
||||
if (textureClient) {
|
||||
@ -621,12 +625,18 @@ CairoImage::GetTextureClient(CompositableClient *aClient)
|
||||
|
||||
RefPtr<SourceSurface> surface = GetAsSourceSurface();
|
||||
MOZ_ASSERT(surface);
|
||||
if (!surface) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// gfx::BackendType::NONE means default to content backend
|
||||
textureClient = aClient->CreateTextureClientForDrawing(surface->GetFormat(),
|
||||
TextureFlags::DEFAULT,
|
||||
gfx::BackendType::NONE,
|
||||
surface->GetSize());
|
||||
if (!textureClient) {
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(textureClient->CanExposeDrawTarget());
|
||||
if (!textureClient->AllocateForSurface(surface->GetSize()) ||
|
||||
!textureClient->Lock(OpenMode::OPEN_WRITE_ONLY)) {
|
||||
|
Loading…
Reference in New Issue
Block a user