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 9429226524 and
a887891271.

Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-117242
Change-Id: I67f6af89027fe36a1915e815acd3c9446f7dcd5d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Ahmad Samir 2023-10-14 23:12:51 +03:00 committed by Marc Mutz
parent 5ceb78e8d9
commit 408799de65

View File

@ -297,15 +297,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();
}