summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-10-14 23:12:51 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-10-18 06:10:43 +0000
commitf0f581ffed2f9cc212ca76d591627748102a7abc (patch)
tree8ba75f17119c5644ed37c184dbd46c5bb4089c1f
parent8d7826442bf889364ab39cf54c6f4617891d0bd7 (diff)
QCoreApplication: use the correct typedef of `preRList`
`QVFuncList` and `QStartUpFuncList` are identical typdefs (`QtCleanUpFunction` and `QtStartUpFunction` are identical typedefs): typedef QList<QtCleanUpFunction> QVFuncList; typedef QList<QtStartUpFunction> QStartUpFuncList; So from the compiler's POV QVFuncList and QStartUpFuncList can be used interchangeably, but from a code reader's POV, this is confusing. Use IILE to make the local variable const. This amends commits 942922652481347659a0dae78758c334778a58d2 and a887891271a52b2546265c13c6dc70fdd08507e3. Pick-to: 6.2 5.15 Fixes: QTBUG-117242 Change-Id: I67f6af89027fe36a1915e815acd3c9446f7dcd5d Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit 408799de65aaa4adcc6660c444f98bfb1a326dfe) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 1c359e6ea1a55d954239f11dfa90aa1beecc4501)
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index d91ec456e0..73df3ccc8d 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -294,15 +294,15 @@ static void qt_call_pre_routines()
if (!preRList.exists())
return;
- QVFuncList list;
- {
+ const QStartUpFuncList list = [] {
const auto locker = qt_scoped_lock(globalRoutinesMutex);
// Unlike qt_call_post_routines, we don't empty the list, because
// Q_COREAPP_STARTUP_FUNCTION is a macro, so the user expects
// the function to be executed every time QCoreApplication is created.
- list = *preRList;
- }
- for (QtCleanUpFunction f : std::as_const(list))
+ return *preRList;
+ }();
+
+ for (QtStartUpFunction f : list)
f();
}