From 8c3332f6195dcf213c481c28ddbff680f20a20a9 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Wed, 21 Feb 2024 20:58:09 +0100 Subject: [PATCH] opengl/eglcontext: tell Qt when the OpenGL context gets changed Otherwise, Qt thinks the old context is still current and will do things like destroying VAOs with KWin's context, which ends up destroying the VAO of the context and breaks rendering. BUG: 479094 --- src/opengl/eglcontext.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/opengl/eglcontext.cpp b/src/opengl/eglcontext.cpp index e41f6130c5..085a198a15 100644 --- a/src/opengl/eglcontext.cpp +++ b/src/opengl/eglcontext.cpp @@ -66,6 +66,10 @@ EglContext::~EglContext() bool EglContext::makeCurrent(EGLSurface surface) const { + if (QOpenGLContext *context = QOpenGLContext::currentContext()) { + // Workaround to tell Qt that no QOpenGLContext is current + context->doneCurrent(); + } return eglMakeCurrent(m_display->handle(), surface, surface, m_handle) == EGL_TRUE; }