diff options
Diffstat (limited to 'src/gui/kernel/qwindowsysteminterface.cpp')
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 40a298226a..5f61853a6d 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -340,13 +340,11 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleExposeEvent, QWindow *window, const QReg QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); } -QT_DEFINE_QPA_EVENT_HANDLER(void, handleCloseEvent, QWindow *window, bool *accepted) +QT_DEFINE_QPA_EVENT_HANDLER(bool, handleCloseEvent, QWindow *window) { - if (window) { - QWindowSystemInterfacePrivate::CloseEvent *e = - new QWindowSystemInterfacePrivate::CloseEvent(window, accepted); - QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); - } + Q_ASSERT(window); + auto *event = new QWindowSystemInterfacePrivate::CloseEvent(window); + return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(event); } /*! @@ -619,6 +617,7 @@ bool QWindowSystemInterface::isTouchDeviceRegistered(const QTouchDevice *device) static int g_nextPointId = 1; // map from device-independent point id (arbitrary) to "Qt point" ids +QMutex QWindowSystemInterfacePrivate::pointIdMapMutex; typedef QMap<quint64, int> PointIdMap; Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap) @@ -636,6 +635,8 @@ Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap) */ static int acquireCombinedPointId(quint8 deviceId, int pointId) { + QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex); + quint64 combinedId64 = (quint64(deviceId) << 32) + pointId; auto it = g_pointIdMap->constFind(combinedId64); int uid; @@ -695,6 +696,8 @@ QList<QTouchEvent::TouchPoint> } if (states == Qt::TouchPointReleased) { + QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex); + // All points on deviceId have been released. // Remove all points associated with that device from g_pointIdMap. // (On other devices, some touchpoints might still be pressed. @@ -714,6 +717,7 @@ QList<QTouchEvent::TouchPoint> void QWindowSystemInterfacePrivate::clearPointIdMap() { + QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex); g_pointIdMap->clear(); g_nextPointId = 1; } |