diff options
Diffstat (limited to 'src/kernel/qapplication.cpp')
-rw-r--r-- | src/kernel/qapplication.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp index 4b2684f18..fbdb9330c 100644 --- a/src/kernel/qapplication.cpp +++ b/src/kernel/qapplication.cpp @@ -572,8 +572,6 @@ private: static TQCoreApplicationThread tqt_main_thread; static TQThread *mainThread() { return &tqt_main_thread; } -#else -static TQThread* mainThread() { return TQThread::currentThread(); } #endif // Definitions for posted events @@ -3033,6 +3031,7 @@ int TQApplication::exec() */ void TQApplication::exit( int retcode ) { +#ifdef TQT_THREAD_SUPPORT TQThread* thread = tqApp->guiThread(); if (thread) { if (thread->d) { @@ -3041,6 +3040,9 @@ void TQApplication::exit( int retcode ) } } } +#else + tqApp->eventLoop()->exit( retcode ); +#endif // TQT_THREAD_SUPPORT } /*! @@ -3540,12 +3542,18 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type ) TQPostEvent *pe; while ( (pe=it.current()) != 0 ) { ++it; + Q_ASSERT(pe->receiver); if ( pe->event // hasn't been sent yet && ( receiver == 0 // we send to all receivers || receiver == pe->receiver ) // we send to THAT receiver && ( event_type == 0 // we send all types || event_type == pe->event->type() ) // we send THAT type - && ( (!pe->receiver) || ((pe->receiver) && (!pe->receiver->wasDeleted) && (pe->receiver->contextThreadObject() == TQThread::currentThreadObject())) ) ) { // only send if active thread is receiver object owning thread + && ( !pe->receiver->wasDeleted ) // don't send if receiver was deleted +#ifdef TQT_THREAD_SUPPORT + // only send if active thread is receiver object owning thread + && ( pe->receiver->contextThreadObject() == TQThread::currentThreadObject() ) +#endif + ) { // first, we diddle the event so that we can deliver // it, and that noone will try to touch it later. pe->event->posted = FALSE; @@ -3796,8 +3804,8 @@ void TQApplication::removePostedEvent( TQEvent * event ) } } -void tqThreadTerminationHandlerRecursive( TQObject* object, TQThread* originThread, TQThread* destinationThread ) { #ifdef TQT_THREAD_SUPPORT +static void tqThreadTerminationHandlerRecursive( TQObject* object, TQThread* originThread, TQThread* destinationThread ) { TQThread* objectThread = object->contextThreadObject(); if (objectThread && (objectThread == originThread)) { TQThread::CleanupType cleanupType = objectThread->cleanupType(); @@ -3822,7 +3830,6 @@ void tqThreadTerminationHandlerRecursive( TQObject* object, TQThread* originThre for ( childObject = children.first(); childObject; childObject = children.next() ) { tqThreadTerminationHandlerRecursive(childObject, originThread, destinationThread); } -#endif // TQT_THREAD_SUPPORT } /*!\internal @@ -3831,15 +3838,14 @@ void tqThreadTerminationHandlerRecursive( TQObject* object, TQThread* originThre for thread destruction. */ void TQApplication::threadTerminationHandler( TQThread *originThread ) { -#ifdef TQT_THREAD_SUPPORT TQMutexLocker locker( tqt_mutex ); TQThread* destinationThread = guiThread(); const TQObjectList* objects = TQObject::objectTrees(); for ( TQObjectListIt objectit( *objects ) ; *objectit; ++objectit ) { tqThreadTerminationHandlerRecursive((*objectit), originThread, destinationThread); } -#endif // TQT_THREAD_SUPPORT } +#endif // TQT_THREAD_SUPPORT /*!\internal |