QtCore: code tidies: use the 4-arg connect overload

The 3-arg connect is error-prone and makes the lifetime of the
connection unclear.

Change-Id: I4f2b54bc086e8f4723a0357d983e3df2f85135ac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2023-06-24 12:36:50 +02:00
parent 838fc606c1
commit 7297cd808b
2 changed files with 5 additions and 2 deletions

View File

@ -50,7 +50,8 @@ template <typename QAS> 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();

View File

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