summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-12-11 15:50:21 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2017-12-12 19:18:38 +0000
commit495833b7965330cc1db5fdce0a3c86f7ec15e836 (patch)
tree5be146f3a722bf9639b2b500e9ff278d2f77ceaa /src/plugins/platforms/eglfs/api/qeglfscursor_p.h
parent06e903cf684a829716736702b95b66846c713fd5 (diff)
[ChangeLog][QPA][eglfs] Fix crash when using cursors and multiple GL contexts
The hash from QOpenGLContext* to cursor texture/shader data can accumulate dangling pointers if the program uses multiple contexts on the same screen. This is fixed by moving the cursor data into the platform context. The code for deleting the texture and shader program is omitted as it is tied to the life time of the context and the GL context deletes its resources automatically upon destruction. Task-number: QTBUG-65119 Change-Id: Ic3b8e5669d14949af811bdf047e7d47000216180 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/plugins/platforms/eglfs/api/qeglfscursor_p.h')
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscursor_p.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
index aaeb83cb99..89c2e89f58 100644
--- a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
@@ -56,6 +56,7 @@
#include <qpa/qplatformscreen.h>
#include <QtGui/QMatrix4x4>
#include <QtGui/QOpenGLFunctions>
+#include <QtGui/QOpenGLShaderProgram>
#include <QtGui/private/qinputdevicemanager_p.h>
QT_BEGIN_NAMESPACE
@@ -81,6 +82,15 @@ private:
#if QT_CONFIG(opengl)
+struct QEglFSCursorData {
+ QScopedPointer<QOpenGLShaderProgram> program;
+ int textureEntry = 0;
+ int matEntry = 0;
+ uint customCursorTexture = 0;
+ uint atlasTexture = 0;
+ qint64 customCursorKey = 0;
+};
+
class Q_EGLFS_EXPORT QEglFSCursor : public QPlatformCursor
, protected QOpenGLFunctions
{
@@ -143,18 +153,6 @@ private:
QEglFSCursorDeviceListener *m_deviceListener;
bool m_updateRequested;
QMatrix4x4 m_rotationMatrix;
-
- struct GraphicsContextData {
- GraphicsContextData() : program(nullptr), textureEntry(0), matEntry(0),
- customCursorTexture(0), atlasTexture(0), customCursorKey(0) { }
- QOpenGLShaderProgram *program;
- int textureEntry;
- int matEntry;
- uint customCursorTexture;
- uint atlasTexture;
- qint64 customCursorKey;
- };
- QHash<QOpenGLContext *, GraphicsContextData> m_gfx;
};
#endif // QT_CONFIG(opengl)