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>
This commit is contained in:
parent
1e97a44e76
commit
f9eb2a7bdb
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user