From 3f19c154c5eff14f5fa8567f08b3a35b251966e3 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 2 Jul 2024 17:52:29 +0800 Subject: [PATCH] QCoreApplication: improve warning in checkReceiverThread - Remove extra '0x'. - Use QDebug::toString() to get more descriptive output for each object involved. Change-Id: I84cadd89f448453cd4d7f1e7073199fd8c6af7a4 Reviewed-by: Fabian Kosmale --- src/corelib/kernel/qcoreapplication.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index a18e3630b37..dee2e9fa975 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -546,11 +546,9 @@ void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver) QThread *thr = receiver->thread(); Q_ASSERT_X(currentThread == thr || !thr, "QCoreApplication::sendEvent", - QString::asprintf("Cannot send events to objects owned by a different thread. " - "Current thread 0x%p. Receiver '%ls' (of type '%s') was created in thread 0x%p", - currentThread, qUtf16Printable(receiver->objectName()), - receiver->metaObject()->className(), thr) - .toLocal8Bit().data()); + qPrintable(QString::fromLatin1("Cannot send events to objects owned by a different thread. " + "Current thread %1. Receiver '%2' was created in thread %3").arg( + QDebug::toString(currentThread), QDebug::toString(receiver), QDebug::toString(thr)))); Q_UNUSED(currentThread); Q_UNUSED(thr); }