summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2025-06-11 13:16:25 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2025-06-13 10:41:50 +0900
commit5e1b31056073d2f8f72161970b5df5f81dac619a (patch)
tree901245242051cca446a7bcf47f48325c1ab263f8 /src
parent331b0cabe62508d18ff1656fa614bfeb50aeebcb (diff)
downloadtqt-5e1b31056073d2f8f72161970b5df5f81dac619a.tar.gz
tqt-5e1b31056073d2f8f72161970b5df5f81dac619a.zip
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 <michele.calgaro@yahoo.it> (cherry picked from commit 6da60fd237eeec4d1611c680202ab28b7e081112)
Diffstat (limited to 'src')
-rw-r--r--src/kernel/qeventloop_x11_glib.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/kernel/qeventloop_x11_glib.cpp b/src/kernel/qeventloop_x11_glib.cpp
index a13dbeebf..695232c2e 100644
--- a/src/kernel/qeventloop_x11_glib.cpp
+++ b/src/kernel/qeventloop_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