From 7dd4848d61e4c52091d6c644356c84c67536bde2 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 16 Jun 2025 18:37:59 +0900 Subject: Fix handling of socket notifier events in gmainloop functions. This resolves issue #231. Signed-off-by: Michele Calgaro (cherry picked from commit 2584dba8aabfa2db8297dcfa258d33545ed6af43) --- src/kernel/qeventloop_x11.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/kernel/qeventloop_x11.cpp') diff --git a/src/kernel/qeventloop_x11.cpp b/src/kernel/qeventloop_x11.cpp index a907a11e1..0d3d6ee10 100644 --- a/src/kernel/qeventloop_x11.cpp +++ b/src/kernel/qeventloop_x11.cpp @@ -231,8 +231,11 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags ) } } + // Include or exclude SocketNotifiers (by setting or cleaning poll events) + // Socket notifier events are only activated in the core application event loop, + // so filter them out in other event loops. int highest = 0; - if ( ! ( flags & ExcludeSocketNotifiers ) ) { + if (!(flags & ExcludeSocketNotifiers) && TQApplication::isGuiThread()) { // return the highest fd we can wait for input on if ( d->sn_highest >= 0 ) { // has socket notifier(s) if ( d->sn_vec[0].list && ! d->sn_vec[0].list->isEmpty() ) @@ -370,7 +373,8 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags ) } // activate socket notifiers - if ( ! ( flags & ExcludeSocketNotifiers ) && nsel > 0 && d->sn_highest >= 0 ) { + if (!(flags & ExcludeSocketNotifiers) && nsel > 0 && d->sn_highest >= 0 && + TQApplication::isGuiThread()) { // if select says data is ready on any socket, then set the socket notifier // to pending int i; -- cgit v1.2.3