[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
This commit is contained in:
David Edmundson 2018-10-05 14:04:09 +01:00
parent e9fd57285f
commit 6ebfa59331

View file

@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <logging.h>
#include <QOpenGLFramebufferObject>
#include <private/qopenglcontext_p.h>
namespace KWin
{
@ -48,6 +49,8 @@ SharingPlatformContext::SharingPlatformContext(QOpenGLContext *context, const EG
bool SharingPlatformContext::makeCurrent(QPlatformSurface *surface)
{
Window *window = static_cast<Window*>(surface);
QOpenGLContextPrivate::setCurrentContext(context());
if (eglMakeCurrent(eglDisplay(), m_surface, m_surface, eglContext())) {
window->bindContentFBO();
return true;