summaryrefslogtreecommitdiff
path: root/gfx/gl/GLContextProviderGLX.cpp
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/GLContextProviderGLX.cpp
parent722161775b9ec9314d1b02f567e42b83115cf993 (diff)
downloaduxp-c6dbf554496191a0cfe4c8f5dbe8c96031d1445b.tar.gz
Issue #1354 - Clear the current context when MakeCurrent() fails.
Diffstat (limited to 'gfx/gl/GLContextProviderGLX.cpp')
-rw-r--r--gfx/gl/GLContextProviderGLX.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/gfx/gl/GLContextProviderGLX.cpp b/gfx/gl/GLContextProviderGLX.cpp
index 539520a8ce..178052f8cb 100644
--- a/gfx/gl/GLContextProviderGLX.cpp
+++ b/gfx/gl/GLContextProviderGLX.cpp
@@ -894,20 +894,12 @@ GLContextGLX::~GLContextGLX()
return;
}
- // see bug 659842 comment 76
-#ifdef DEBUG
- bool success =
-#endif
- mGLX->xMakeCurrent(mDisplay, X11None, nullptr);
- MOZ_ASSERT(success,
- "glXMakeCurrent failed to release GL context before we call "
- "glXDestroyContext!");
-
mGLX->xDestroyContext(mDisplay, mContext);
if (mDeleteDrawable) {
mGLX->xDestroyPixmap(mDisplay, mDrawable);
}
+ MOZ_ASSERT(!mOverrideDrawable);
}
@@ -944,6 +936,10 @@ GLContextGLX::MakeCurrentImpl(bool aForce)
// DRI2InvalidateBuffers event before drawing. See bug 1280653.
Unused << XPending(mDisplay);
}
+ if (IsDestroyed()) {
+ MOZ_ALWAYS_TRUE(mGLX->xMakeCurrent(mDisplay, X11None, nullptr);
+ return false; // We did not MakeCurrent mContext, but that's what we wanted!
+ }
succeeded = mGLX->xMakeCurrent(mDisplay, mDrawable, mContext);
NS_ASSERTION(succeeded, "Failed to make GL context current!");
@@ -1017,16 +1013,18 @@ GLContextGLX::GetWSIInfo(nsCString* const out) const
bool
GLContextGLX::OverrideDrawable(GLXDrawable drawable)
{
- if (Screen())
+ if (Screen()) {
Screen()->AssureBlitted();
- Bool result = mGLX->xMakeCurrent(mDisplay, drawable, mContext);
- return result;
+ }
+ mOverrideDrawable = Some(drawable);
+ return MakeCurrent(true);
}
bool
GLContextGLX::RestoreDrawable()
{
- return mGLX->xMakeCurrent(mDisplay, mDrawable, mContext);
+ mOverrideDrawable = Nothing();
+ return MakeCurrent(true);
}
GLContextGLX::GLContextGLX(