diff options
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.h | 1 | ||||
-rw-r--r-- | src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp | 8 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index cae976098c..f1c43110e3 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -442,6 +442,11 @@ void QWindowSystemInterface::unregisterTouchDevice(const QTouchDevice *device) QTouchDevicePrivate::unregisterDevice(device); } +bool QWindowSystemInterface::isTouchDeviceRegistered(const QTouchDevice *device) +{ + return QTouchDevicePrivate::isRegistered(device); +} + void QWindowSystemInterface::handleTouchEvent(QWindow *w, QTouchDevice *device, const QList<TouchPoint> &points, Qt::KeyboardModifiers mods) { diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 69c850ad3e..b4f6020fe2 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -123,6 +123,7 @@ public: static void registerTouchDevice(const QTouchDevice *device); static void unregisterTouchDevice(const QTouchDevice *device); + static bool isTouchDeviceRegistered(const QTouchDevice *device); static void handleTouchEvent(QWindow *w, QTouchDevice *device, const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier); static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device, diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index 7cb4813c7b..f863629ff9 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -393,9 +393,13 @@ void QEvdevTouchScreenHandler::unregisterTouchDevice() if (!m_device) return; - QWindowSystemInterface::unregisterTouchDevice(m_device); + // At app exit the cleanup may have already been done, avoid + // double delete by checking the list first. + if (QWindowSystemInterface::isTouchDeviceRegistered(m_device)) { + QWindowSystemInterface::unregisterTouchDevice(m_device); + delete m_device; + } - delete m_device; m_device = Q_NULLPTR; } |