From c9354429dd90aff3f1174d0b56515cb4a8aef9c2 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 19 Feb 2016 20:02:30 +0100 Subject: 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 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qeventdispatcher_unix.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 9afbb84abf..802962d77d 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -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 -- cgit v1.2.3