diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-01-20 22:35:36 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-01-20 22:42:14 +0100 |
commit | c6dbf554496191a0cfe4c8f5dbe8c96031d1445b (patch) | |
tree | 72c14ce62e8de6f6f2273799b7badf445ced07d4 /gfx/gl/GLContextProviderCGL.mm | |
parent | 722161775b9ec9314d1b02f567e42b83115cf993 (diff) | |
download | UXP-c6dbf554496191a0cfe4c8f5dbe8c96031d1445b.tar UXP-c6dbf554496191a0cfe4c8f5dbe8c96031d1445b.tar.gz UXP-c6dbf554496191a0cfe4c8f5dbe8c96031d1445b.tar.lz UXP-c6dbf554496191a0cfe4c8f5dbe8c96031d1445b.tar.xz UXP-c6dbf554496191a0cfe4c8f5dbe8c96031d1445b.zip |
Issue #1354 - Clear the current context when MakeCurrent() fails.
Diffstat (limited to 'gfx/gl/GLContextProviderCGL.mm')
-rw-r--r-- | gfx/gl/GLContextProviderCGL.mm | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/gfx/gl/GLContextProviderCGL.mm b/gfx/gl/GLContextProviderCGL.mm index ceab3046c..7cc89eac9 100644 --- a/gfx/gl/GLContextProviderCGL.mm +++ b/gfx/gl/GLContextProviderCGL.mm @@ -83,26 +83,13 @@ GLContextCGL::GLContextCGL(CreateContextFlags flags, const SurfaceCaps& caps, GLContextCGL::~GLContextCGL() { MarkDestroyed(); - - if (mContext) { - if ([NSOpenGLContext currentContext] == mContext) { - // Clear the current context before releasing. If we don't do - // this, the next time we call [NSOpenGLContext currentContext], - // "invalid context" will be printed to the console. - [NSOpenGLContext clearCurrentContext]; - } - [mContext release]; - } - + [mContext release]; } bool GLContextCGL::Init() { - if (!InitWithPrefix("gl", true)) - return false; - - return true; + return InitWithPrefix("gl", true); } CGLContextObj @@ -114,6 +101,11 @@ GLContextCGL::GetCGLContext() const bool GLContextCGL::MakeCurrentImpl(bool aForce) { + if (IsDestroyed()) { + [NSOpenGLContext clearCurrentContext]; + return false; + } + if (!aForce && [NSOpenGLContext currentContext] == mContext) { return true; } |