diff --git a/gfx/gl/GLTextureImage.cpp b/gfx/gl/GLTextureImage.cpp index 77b5ef6ce5d..524456b2b4c 100644 --- a/gfx/gl/GLTextureImage.cpp +++ b/gfx/gl/GLTextureImage.cpp @@ -73,9 +73,8 @@ BasicTextureImage::~BasicTextureImage() // if we don't have a context (either real or shared), // then they went away when the contex was deleted, because it // was the only one that had access to it. - if (ctx && !ctx->IsDestroyed()) { - mGLContext->MakeCurrent(); - mGLContext->fDeleteTextures(1, &mTexture); + if (ctx && ctx->MakeCurrent()) { + ctx->fDeleteTextures(1, &mTexture); } } @@ -699,7 +698,9 @@ CreateBasicTextureImage(GLContext* aGL, TextureImage::ImageFormat aImageFormat) { bool useNearestFilter = aFlags & TextureImage::UseNearestFilter; - aGL->MakeCurrent(); + if (!aGL->MakeCurrent()) { + return nullptr; + } GLuint texture = 0; aGL->fGenTextures(1, &texture);