summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaehak Lee <jaehak.lee@mobis.co.kr>2020-11-08 11:40:06 +0900
committerJaehak Lee <jaehak.lee@mobis.co.kr>2020-11-18 16:42:04 +0900
commit2c0a03e9aea13831d05ac03996949f888afd5085 (patch)
tree01f9b8d4ea6721e56297ce3d79fee558299b1702
parenta825fb5f714fd79d16cc3ebbdd327e7961b07d0a (diff)
Do not try to eglMakeCurrent for unintended case
The QSGThreadedRenderLoop::hide can be called at twice, when the QWindowPrivate::setVisible(false) is called. The eglSurface is EGL_NO_SURFACE when the second QSGThreadedRenderLoop::hide is called. And if EGL_KHR_surfaceless_context is supported, the eglMakeCurrent don't return the false. But this case is not intended. So, add the defence code for above case. Fixes: QTBUG-88277 Change-Id: Ia9e5990303e98f0eedc48531e5af62ff9961f419 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp6
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
index ccebf43d0..681f82f4a 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -336,6 +336,8 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *dis
<< "It may also cause the event loop to freeze in some situations";
}
+ m_supportSurfaceLessContext = q_hasEglExtension(m_eglDisplay, "EGL_KHR_surfaceless_context");
+
updateGLFormat();
}
@@ -439,6 +441,10 @@ bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
eglSurface = window->eglSurface();
}
+ if (eglSurface == EGL_NO_SURFACE && m_supportSurfaceLessContext) {
+ return false;
+ }
+
if (!eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context)) {
qWarning("QWaylandGLContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this);
window->setCanResize(true);
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h
index 46c7bb76d..93edaec0e 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h
@@ -93,6 +93,7 @@ private:
DecorationsBlitter *m_blitter = nullptr;
uint m_api;
bool m_supportNonBlockingSwap = true;
+ bool m_supportSurfaceLessContext = false;
};
}