From 24bc3fed6c4a5c4a67c2b8132fce0c35e56cff6b Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 17 Jun 2022 11:14:33 +0300 Subject: [PATCH] qpa: Fix a crash in EGLPlatformContext::swapBuffers() After internalWindow->present() is called, we cannot guarantee that the current opengl context hasn't changed. If kwin changes the current opengl context, bindContextFBO() can crash because there may not be current QOpenGLContext. BUG: 455435 --- src/plugins/qpa/eglplatformcontext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/qpa/eglplatformcontext.cpp b/src/plugins/qpa/eglplatformcontext.cpp index c469c1ad81..5e890e6e98 100644 --- a/src/plugins/qpa/eglplatformcontext.cpp +++ b/src/plugins/qpa/eglplatformcontext.cpp @@ -120,8 +120,9 @@ void EGLPlatformContext::swapBuffers(QPlatformSurface *surface) } context()->makeCurrent(surface->surface()); glFlush(); - internalWindow->present(window->swapFBO()); + auto fbo = window->swapFBO(); window->bindContentFBO(); + internalWindow->present(fbo); } }