From 6ebfa59331b7febf162d05eef8316b12d559de9b Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 5 Oct 2018 14:04:09 +0100 Subject: [PATCH] [plugins/qpa] Don't crash on Qt5.12 OpengGL::makeCurrent Summary: QOpenGLContext was changed to call platform->makeCurrent before it called setCurrentContext. Because we bind window FBO and ultimately that calls QOpenGlContext::format we need Qt to know which context is current so it can tell us the format. This matches the QtWayland EGL code. BUG: 399392 Test Plan: Switched virtual desktop with the OSD (previously reliably crashed) Now it doesn't Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: zzag, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D15957 --- plugins/qpa/sharingplatformcontext.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/qpa/sharingplatformcontext.cpp b/plugins/qpa/sharingplatformcontext.cpp index 895da23b47..a318bf0795 100644 --- a/plugins/qpa/sharingplatformcontext.cpp +++ b/plugins/qpa/sharingplatformcontext.cpp @@ -26,6 +26,7 @@ along with this program. If not, see . #include #include +#include namespace KWin { @@ -48,6 +49,8 @@ SharingPlatformContext::SharingPlatformContext(QOpenGLContext *context, const EG bool SharingPlatformContext::makeCurrent(QPlatformSurface *surface) { Window *window = static_cast(surface); + + QOpenGLContextPrivate::setCurrentContext(context()); if (eglMakeCurrent(eglDisplay(), m_surface, m_surface, eglContext())) { window->bindContentFBO(); return true;