From 92eb2f691bb773744a8e427bd13ea32ba39d5078 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 14 Feb 2024 10:01:30 +0100 Subject: [PATCH] QGuiApplication: copy a Prealloc value instead of hard-coding 16 The EventPointMap QPointingDevicePrivate::activePoints is actually a QVarLengthFlatMap<., ., 20>, not 16, so copy the value instead of just hard-coding something. Amends 296ede3aab2c0cc1acd28a2adb3017ac74d7ed6b. Change-Id: Ic8e83f4095f57be74f7708d5cec6a19971772b76 Reviewed-by: Fabian Kosmale --- src/gui/kernel/qguiapplication.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 60b6c58b455..094da531ee2 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2934,7 +2934,8 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To // Send the TouchCancel to all windows with active touches and clean up. QTouchEvent touchEvent(QEvent::TouchCancel, device, e->modifiers); touchEvent.setTimestamp(e->timestamp); - QMinimalVarLengthFlatSet windowsNeedingCancel; + constexpr qsizetype Prealloc = decltype(devPriv->activePoints)::mapped_container_type::PreallocatedSize; + QMinimalVarLengthFlatSet windowsNeedingCancel; for (auto &epd : devPriv->activePoints.values()) { if (QWindow *w = QMutableEventPoint::window(epd.eventPoint))