Issue #1354 - Clear the current context when MakeCurrent() fails.

This commit is contained in:
wolfbeast 2020-01-20 22:35:36 +01:00 committed by Roy Tam
commit 9d76eb5791
10 changed files with 81 additions and 95 deletions

View file

@ -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