diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-10-14 23:12:51 +0300 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-10-17 19:23:42 +0000 |
commit | 408799de65aaa4adcc6660c444f98bfb1a326dfe (patch) | |
tree | c6735678545e164bed7adfb093b044321ec3fe7d | |
parent | 5ceb78e8d92dab73cef10a37578a3de799d7880b (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.6 6.5 6.2 5.15
Fixes: QTBUG-117242
Change-Id: I67f6af89027fe36a1915e815acd3c9446f7dcd5d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 60f956faed..0823826b51 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -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(); } |