diff --git a/src/corelib/kernel/qapplicationstatic.h b/src/corelib/kernel/qapplicationstatic.h index 1eadeb20e2..f2f0911856 100644 --- a/src/corelib/kernel/qapplicationstatic.h +++ b/src/corelib/kernel/qapplicationstatic.h @@ -50,7 +50,8 @@ template struct ApplicationHolder QMutexLocker locker(&mutex); if (guard.loadRelaxed() == QtGlobalStatic::Uninitialized) { QAS::innerFunction(&storage); - QObject::connect(QCoreApplication::instance(), &QObject::destroyed, reset); + const auto *app = QCoreApplication::instance(); + QObject::connect(app, &QObject::destroyed, app, reset, Qt::DirectConnection); guard.storeRelease(QtGlobalStatic::Initialized); } return realPointer(); diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 9f00bf407d..61369420d1 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -1245,7 +1245,9 @@ QDaemonThread::QDaemonThread(QObject *parent) { // QThread::started() is emitted from the thread we start connect(this, &QThread::started, - [](){ QThreadData::current()->requiresCoreApplication = false; }); + this, + [](){ QThreadData::current()->requiresCoreApplication = false; }, + Qt::DirectConnection); } QDaemonThread::~QDaemonThread()