summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-05-17 09:55:09 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-05-18 17:54:15 +0200
commit042bab072a65f2f3054531ec4f7eb28afbe38e78 (patch)
treebe71505367ac84ea54cb4f9bd5abdec8bd1b473f /src/corelib
parent7b736e1faf1fb6ed69a0a4b53b96ec3a9e9941e8 (diff)
Fix return value of qGlobalPostedEventsCount()
The unsigned return value was very un-Qt-ish, and, indeed, tst_QCoreApplication just stored the result in ints. Port to qsizetype, being the type of the expression that the function calculates. Task-number: QTBUG-103532 Change-Id: I95a81a686439b0686faad7a430adeaab66dc9e8d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher_p.h2
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/kernel/qabstracteventdispatcher_p.h b/src/corelib/kernel/qabstracteventdispatcher_p.h
index 81ce39ffb8..e7b1ac3b24 100644
--- a/src/corelib/kernel/qabstracteventdispatcher_p.h
+++ b/src/corelib/kernel/qabstracteventdispatcher_p.h
@@ -20,7 +20,7 @@
QT_BEGIN_NAMESPACE
-Q_AUTOTEST_EXPORT uint qGlobalPostedEventsCount();
+Q_AUTOTEST_EXPORT qsizetype qGlobalPostedEventsCount();
class Q_CORE_EXPORT QAbstractEventDispatcherPrivate : public QObjectPrivate
{
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 1e8b209ff8..0dafc40381 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -321,10 +321,10 @@ Q_CONSTINIT bool QCoreApplicationPrivate::is_app_running = false;
// app closing down if true
Q_CONSTINIT bool QCoreApplicationPrivate::is_app_closing = false;
-uint qGlobalPostedEventsCount()
+qsizetype qGlobalPostedEventsCount()
{
- QThreadData *currentThreadData = QThreadData::current();
- return currentThreadData->postEventList.size() - currentThreadData->postEventList.startOffset;
+ const QPostEventList &l = QThreadData::current()->postEventList;
+ return l.size() - l.startOffset;
}
Q_CONSTINIT QAbstractEventDispatcher *QCoreApplicationPrivate::eventDispatcher = nullptr;