From e04ab02b6412393cc945df67ee155fee318c07b0 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 5 Feb 2023 18:43:09 +0100 Subject: [PATCH] Fix narrowing in Qt::endPropertyUpdateGroup() decltype(QPropertyDelayedNotifications::used) is qsizetype, not int, so don't use int to count from 0...used. The notify() and evaluateBinding() functions use their int argument only for pointer arithmetic, so this is completely self-contained. Amends fdedcb6ec650236bef4a8c8f005b5dd24ef7d77a. Manual conflict resolutions: - evaluateBindings() returns void in 6.2 Task-number: QTBUG-103532 Task-number: QTBUG-110710 Change-Id: I765a06628d330fbb57a2fbecc96d66690bb62f13 Reviewed-by: Fabian Kosmale (cherry picked from commit d257a56c93e58028031c41daf90d3d4e8f317846) Reviewed-by: Marc Mutz --- src/corelib/kernel/qproperty.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp index 2a7d3ddaec0..ea7635a58f2 100644 --- a/src/corelib/kernel/qproperty.cpp +++ b/src/corelib/kernel/qproperty.cpp @@ -154,7 +154,7 @@ struct QPropertyDelayedNotifications Change notifications are sent later with notify (following the logic of separating binding updates and notifications used in non-deferred updates). */ - void evaluateBindings(int index, QBindingStatus *status) { + void evaluateBindings(qsizetype index, QBindingStatus *status) { auto *delayed = delayedProperties + index; auto *bindingData = delayed->originalBindingData; if (!bindingData) @@ -182,7 +182,7 @@ struct QPropertyDelayedNotifications \li sends any pending notifications. \endlist */ - void notify(int index) { + void notify(qsizetype index) { auto *delayed = delayedProperties + index; auto *bindingData = delayed->originalBindingData; if (!bindingData) @@ -252,14 +252,14 @@ void Qt::endPropertyUpdateGroup() // update all delayed properties auto start = data; while (data) { - for (int i = 0; i < data->used; ++i) + for (qsizetype i = 0; i < data->used; ++i) data->evaluateBindings(i, status); data = data->next; } // notify all delayed properties data = start; while (data) { - for (int i = 0; i < data->used; ++i) + for (qsizetype i = 0; i < data->used; ++i) data->notify(i); auto *next = data->next; delete data;