diff options
Diffstat (limited to 'src/corelib/kernel/qsocketnotifier.cpp')
-rw-r--r-- | src/corelib/kernel/qsocketnotifier.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/kernel/qsocketnotifier.cpp b/src/corelib/kernel/qsocketnotifier.cpp index 6470873d9a..2598f02a19 100644 --- a/src/corelib/kernel/qsocketnotifier.cpp +++ b/src/corelib/kernel/qsocketnotifier.cpp @@ -274,6 +274,10 @@ void QSocketNotifier::setEnabled(bool enable) if (!d->threadData->eventDispatcher.load()) // perhaps application/thread is shutting down return; + if (Q_UNLIKELY(thread() != QThread::currentThread())) { + qWarning("QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread"); + return; + } if (d->snenabled) d->threadData->eventDispatcher.load()->registerSocketNotifier(this); else |