summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@qt.io>2022-07-13 15:32:46 +0200
committerDominik Holland <dominik.holland@qt.io>2022-08-05 14:41:04 +0000
commitf9eb2a7bdb9c86166848b3ff96ac7e055a8f567b (patch)
treeea571be52d86e099bacdc9f82f028d97c02c6ec9
parent1e97a44e765a61305f3d8ffbca5d33c05008744c (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. Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I4ac2f5184c2fce27421e92efe1b7f635c71c0e92 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-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) {