Commit aefb5f4d authored by Martin Flöser's avatar Martin Flöser
Browse files

Prevent endless loop in checkGLError due to GL_CONTEXT_LOST

The GL_CONTEXT_LOST flag is not reset when calling glGetError. This of
course bites with: "Thus, glGetError should always be called in a loop,
until it returns GL_NO_ERROR, if all error flags are to be reset."

As KWin calls checkGLError from init call it can result in a freeze of
KWin. This is a regression reported multiple times since the release of
5.10.3 which enabled GLX_NV_robustness_video_memory_purge extension.

Please note that I am not able to test this change. I do not have an
NVIDIA card and are not hiting the problem. I have no way to simulate
the code. I do not know whether the change will fix the problem, it is
based on what others do. Inspiration for this change is mostly from

BUG: 381870

Test Plan: See above, I can only compile check the change

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision:
parent 113be5fa
......@@ -128,11 +128,19 @@ static QString formatGLError(GLenum err)
bool checkGLError(const char* txt)
GLenum err = glGetError();
if (err == GL_CONTEXT_LOST) {
qCWarning(LIBKWINGLUTILS) << "GL error: context lost";
return true;
bool hasError = false;
while (err != GL_NO_ERROR) {
qCWarning(LIBKWINGLUTILS) << "GL error (" << txt << "): " << formatGLError(err);
hasError = true;
err = glGetError();
if (err == GL_CONTEXT_LOST) {
qCWarning(LIBKWINGLUTILS) << "GL error: context lost";
return hasError;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment