diff options
author | Liang Qi <liang.qi@qt.io> | 2017-02-14 11:33:02 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-02-14 11:33:02 +0100 |
commit | 27432d40f2500b11780398f6c7d67719050dae6c (patch) | |
tree | 97f9a60af2d520d66fa7ff802ccddad56e0cadaf /src/corelib/kernel/qcoreapplication.cpp | |
parent | 071a120400b17eaa0b414a0ed262b0a090908679 (diff) | |
parent | 10ecbc4041cb7db004f4ed4d40ce082553d75844 (diff) |
Merge remote-tracking branch 'origin/5.8' into 5.9
Change-Id: I2bd2e61bae1eab4fc74fa6accd741ed9ae1f0669
Diffstat (limited to 'src/corelib/kernel/qcoreapplication.cpp')
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index a936457bce..0ac49c5019 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -305,12 +305,13 @@ void qRemovePostRoutine(QtCleanUpFunction p) static void qt_call_pre_routines() { - QStartUpFuncList *list = preRList(); - if (!list) + if (!preRList.exists()) return; + #ifndef QT_NO_THREAD QMutexLocker locker(&globalPreRoutinesMutex); #endif + QVFuncList *list = &(*preRList); // 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. @@ -320,16 +321,10 @@ static void qt_call_pre_routines() void Q_CORE_EXPORT qt_call_post_routines() { - QVFuncList *list = 0; - QT_TRY { - list = postRList(); - } QT_CATCH(const std::bad_alloc &) { - // ignore - if we can't allocate a post routine list, - // there's a high probability that there's no post - // routine to be executed :) - } - if (!list) + if (!postRList.exists()) return; + + QVFuncList *list = &(*postRList); while (!list->isEmpty()) (list->takeFirst())(); } |