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.5 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>
This commit is contained in:
Ahmad Samir 2023-10-14 23:12:51 +03:00 committed by Qt Cherry-pick Bot
parent 73cae2903b
commit 1c359e6ea1

View File

@ -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();
}