QSocketNotifier: improve warning to show thread names and pointers.

Much like the QObject::setParent() warning, which helps a bit when debugging.

Change-Id: I2abf277a12aa1ce04bd8b5759f46f8bfdcb25383
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
David Faure 2016-02-19 20:02:30 +01:00
parent fdd15b7f99
commit c9354429dd

View File

@ -421,7 +421,12 @@ void QEventDispatcherUNIX::unregisterSocketNotifier(QSocketNotifier *notifier)
QSocketNotifier::Type type = notifier->type();
#ifndef QT_NO_DEBUG
if (notifier->thread() != thread() || thread() != QThread::currentThread()) {
qWarning("QSocketNotifier: socket notifiers cannot be disabled from another thread");
qWarning("QSocketNotifier: socket notifier (fd %d) cannot be disabled from another thread.\n"
"(Notifier's thread is %s(%p), event dispatcher's thread is %s(%p), current thread is %s(%p))",
sockfd,
notifier->thread() ? notifier->thread()->metaObject()->className() : "QThread", notifier->thread(),
thread() ? thread()->metaObject()->className() : "QThread", thread(),
QThread::currentThread() ? QThread::currentThread()->metaObject()->className() : "QThread", QThread::currentThread());
return;
}
#endif