Make sure to release thread local storage for unterminated threads. This resolves issue #131.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/132/head
Michele Calgaro 2 months ago
parent b1e6f38464
commit 95b478863b
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -571,7 +571,7 @@ public:
// avoid warning from TQThread // avoid warning from TQThread
d->running = false; d->running = false;
// do some cleanup, namely clean up the thread-local storage associated with the GUI thread // do some cleanup, namely clean up the thread-local storage associated with the GUI thread
TQThreadInstance::finishGuiThread(d); TQThreadInstance::releaseThreadStorage(d);
} }
static TQCoreApplicationThread* self() { return tqt_gui_thread_self; } static TQCoreApplicationThread* self() { return tqt_gui_thread_self; }

@ -168,6 +168,9 @@ TQThread::~TQThread()
if ( d->running && !d->finished ) { if ( d->running && !d->finished ) {
#ifdef QT_CHECK_STATE #ifdef QT_CHECK_STATE
tqWarning("TQThread object destroyed while thread is still running."); tqWarning("TQThread object destroyed while thread is still running.");
// clean up the thread-local storage, which otherwise would be leaked
TQThreadInstance::releaseThreadStorage(d);
#endif #endif
d->orphan = TRUE; d->orphan = TRUE;

@ -180,7 +180,7 @@ void TQThreadInstance::finish( void * )
} }
} }
void TQThreadInstance::finishGuiThread(TQThreadInstance *d) { void TQThreadInstance::releaseThreadStorage(TQThreadInstance *d) {
TQThreadStorageData::finish( d->thread_storage ); TQThreadStorageData::finish( d->thread_storage );
d->thread_storage = 0; d->thread_storage = 0;
} }

@ -100,7 +100,7 @@ public:
static void finish( TQThreadInstance * ); static void finish( TQThreadInstance * );
#endif // Q_OS_WIN32 #endif // Q_OS_WIN32
static void finishGuiThread( TQThreadInstance *d ); static void releaseThreadStorage( TQThreadInstance *d );
TQEventLoop* eventLoop; TQEventLoop* eventLoop;
int cleanupType; int cleanupType;

Loading…
Cancel
Save