From 83d39cad274f592a43a3262926d215493caea0bc Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 22 Apr 2013 21:25:32 -0500 Subject: Fix a number of threading problems and crashes This partially resolves Bug 1467 --- src/kernel/qeventloop_x11_glib.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/kernel/qeventloop_x11_glib.cpp') diff --git a/src/kernel/qeventloop_x11_glib.cpp b/src/kernel/qeventloop_x11_glib.cpp index d37fbee..5226aa9 100644 --- a/src/kernel/qeventloop_x11_glib.cpp +++ b/src/kernel/qeventloop_x11_glib.cpp @@ -484,8 +484,9 @@ bool QEventLoop::gsourceCheck(GSource *gs) { //if ( list ) { QSockNotGPollFD *sn = list->first(); while ( sn ) { - if ( sn->gPollFD.revents ) + if ( sn->gPollFD.revents ) { return TRUE; + } sn = list->next(); } //} @@ -513,7 +514,7 @@ bool QEventLoop::gsourceCheck(GSource *gs) { } // check if we have timers to activate? - timeval * tm =qt_wait_timer(); + 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"); @@ -582,14 +583,18 @@ bool QEventLoop::gsourceDispatch(GSource *gs) { sn = list->next(); } // } - - nevents += activateSocketNotifiers(); + + if (QApplication::isGuiThread()) { + nevents += activateSocketNotifiers(); + } } // activate timers if ( ! ( flags & 0x08 ) ) { // 0x08 == ExcludeTimers for X11 only - nevents += activateTimers(); + if (QApplication::isGuiThread()) { + nevents += activateTimers(); + } } // return true if we handled events, false otherwise -- cgit v1.2.1