From c6cfa2270b6d25921373f959b318d89f7098f710 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 9 Aug 2016 13:33:14 +0200 Subject: evdevtouch: Avoid crashing on exit 26238aca8c442736f380eb523ef48468f892bdb7 causes double deletion of the QTouchDevice in case the post routine already cleaned up the list by the time the touch handler gets to do it. Just check the list of devices to see if the one we hold is still there. If not, the pointer is likely to be a dangling one so do nothing. This will avoid dying with bus error or similar on application exit. Task-number: QTBUG-51562 Change-Id: I50c1edee7405aad308274538219698388c2cc9f9 Reviewed-by: Shawn Rutledge --- src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/platformsupport') 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; } -- cgit v1.2.3