summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@qt.io>2022-07-13 15:32:46 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-08-05 16:18:03 +0000
commit45071f540aaf732ee0e81260d3f081e996b2bc84 (patch)
tree8e9f4bc60998524567a0019f0001a112eb4da81f
parent2ef512f24312884eddff341428257114d04fc2e2 (diff)
eglfs: Fix crash when painting the mouse cursor in a multiscreen setup
Always make sure to initialize the OpenGL functions. Instead of relying on the shaderprogram initialization, which is bound to the current context, check for the d_ptr and initialize when not already done. With this fix QEglFSCursor::draw works regardless of which context is current and checking for that is not needed anymore in paintOnScreen. This is important as the basic render loop only uses one context for painting on all screens, while the threaded render loop uses multiple contexts. Change-Id: I4ac2f5184c2fce27421e92efe1b7f635c71c0e92 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit f9eb2a7bdb9c86166848b3ff96ac7e055a8f567b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscursor.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
index 05a86cee64..dadde5905e 100644
--- a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
@@ -309,8 +309,7 @@ void QEglFSCursor::paintOnScreen()
// screens are siblings of each other. When not enabled, the sibling list
// only contains m_screen itself.
for (QPlatformScreen *screen : m_screen->virtualSiblings()) {
- if (screen->geometry().contains(cr.topLeft().toPoint() + m_cursor.hotSpot)
- && QOpenGLContext::currentContext()->screen() == screen->screen())
+ if (screen->geometry().contains(cr.topLeft().toPoint() + m_cursor.hotSpot))
{
cr.translate(-screen->geometry().topLeft());
const QSize screenSize = screen->geometry().size();
@@ -433,11 +432,12 @@ void QEglFSCursor::draw(const QRectF &r)
{
StateSaver stateSaver;
- QEglFSCursorData &gfx = static_cast<QEglFSContext*>(QOpenGLContext::currentContext()->handle())->cursorData;
- if (!gfx.program) {
- // one time initialization
+ // one time initialization
+ if (!QOpenGLFunctions::d_ptr)
initializeOpenGLFunctions();
+ QEglFSCursorData &gfx = static_cast<QEglFSContext*>(QOpenGLContext::currentContext()->handle())->cursorData;
+ if (!gfx.program) {
createShaderPrograms();
if (!gfx.atlasTexture) {