summaryrefslogtreecommitdiffstats
path: root/gfx/gl/GLContextProviderEAGL.mm
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-01-20 22:35:36 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-01-20 22:42:14 +0100
commitc6dbf554496191a0cfe4c8f5dbe8c96031d1445b (patch)
tree72c14ce62e8de6f6f2273799b7badf445ced07d4 /gfx/gl/GLContextProviderEAGL.mm
parent722161775b9ec9314d1b02f567e42b83115cf993 (diff)
downloadUXP-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/GLContextProviderEAGL.mm')
-rw-r--r--gfx/gl/GLContextProviderEAGL.mm41
1 files changed, 15 insertions, 26 deletions
diff --git a/gfx/gl/GLContextProviderEAGL.mm b/gfx/gl/GLContextProviderEAGL.mm
index 507616e2f..11c7cce77 100644
--- a/gfx/gl/GLContextProviderEAGL.mm
+++ b/gfx/gl/GLContextProviderEAGL.mm
@@ -36,35 +36,24 @@ GLContextEAGL::GLContextEAGL(CreateContextFlags flags, const SurfaceCaps& caps,
GLContextEAGL::~GLContextEAGL()
{
- MakeCurrent();
-
- if (mBackbufferFB) {
- fDeleteFramebuffers(1, &mBackbufferFB);
- }
-
- if (mBackbufferRB) {
- fDeleteRenderbuffers(1, &mBackbufferRB);
+ if (MakeCurrent()) {
+ if (mBackbufferFB) {
+ fDeleteFramebuffers(1, &mBackbufferFB);
+ }
+ if (mBackbufferRB) {
+ fDeleteRenderbuffers(1, &mBackbufferRB);
+ }
}
+ mLayer = nil;
MarkDestroyed();
-
- if (mLayer) {
- mLayer = nil;
- }
-
- if (mContext) {
- [EAGLContext setCurrentContext:nil];
- [mContext release];
- }
+ [mContext release];
}
bool
GLContextEAGL::Init()
{
- if (!InitWithPrefix("gl", true))
- return false;
-
- return true;
+ return InitWithPrefix("gl", true);
}
bool
@@ -120,12 +109,12 @@ GLContextEAGL::MakeCurrentImpl(bool aForce)
return true;
}
- if (mContext) {
- if(![EAGLContext setCurrentContext:mContext]) {
- return false;
- }
+ if (IsDestroyed()) {
+ [EAGLContext setCurrentContext:nil];
+ return false;
}
- return true;
+
+ return [EAGLContext setCurrentContext:mContext];
}
bool