mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-19 14:57:32 +09:00
Issue #1354 - Clear the current context when MakeCurrent() fails.
This commit is contained in:
parent
8d600c51ed
commit
9d76eb5791
10 changed files with 81 additions and 95 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue