From 6da60fd237eeec4d1611c680202ab28b7e081112 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Wed, 11 Jun 2025 13:16:25 +0900 Subject: Do not check for expired TQt timers in 'gsourcePrepare' and 'gsourceCheck' since timers are only activated by the main GUI thread in 'gsourceDispatch'. This solves issue TDE/tdebase#635. Signed-off-by: Michele Calgaro --- src/kernel/tqeventloop_x11_glib.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/kernel/tqeventloop_x11_glib.cpp') diff --git a/src/kernel/tqeventloop_x11_glib.cpp b/src/kernel/tqeventloop_x11_glib.cpp index cf2126591..3608091b5 100644 --- a/src/kernel/tqeventloop_x11_glib.cpp +++ b/src/kernel/tqeventloop_x11_glib.cpp @@ -408,13 +408,15 @@ bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout) static timeval zerotm; timeval *tm = 0; if ( ! ( flags & 0x08 ) ) { // 0x08 == ExcludeTimers for X11 only - tm = qt_wait_timer(); // wait for timer or X event - if ( !canWait ) { - if ( !tm ) { - tm = &zerotm; + if (TQApplication::isGuiThread()) { + tm = qt_wait_timer(); // wait for TQt timers + if ( !canWait ) { + if ( !tm ) { + tm = &zerotm; + } + tm->tv_sec = 0; // no time to wait + tm->tv_usec = 0; } - tm->tv_sec = 0; // no time to wait - tm->tv_usec = 0; } } @@ -525,13 +527,15 @@ bool TQEventLoop::gsourceCheck(GSource *gs) { } // check if we have timers to activate? - timeval * tm = qt_wait_timer(); - if (tm && (tm->tv_sec == 0 && tm->tv_usec == 0 )) { + if (TQApplication::isGuiThread()) { + timeval *tm = qt_wait_timer(); + if (tm && (tm->tv_sec == 0 && tm->tv_usec == 0 )) { #ifdef DEBUG_QT_GLIBMAINLOOP - printf("inside gsourceCheck(2) qtwaittimer!\n"); + printf("inside gsourceCheck(2) qtwaittimer!\n"); #endif - return TRUE; + return TRUE; + } } // nothing to dispatch -- cgit v1.2.3