summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2024-03-29 16:40:30 +0300
committerAlexander Golubev <fatzer2@gmail.com>2024-03-29 21:31:02 +0300
commitfa52f57da125cb9003526976f53656197a930879 (patch)
tree420019e4ddcee3a429327b0dc95b6c4a36497fff
parent34dbe21c8d3dae60f93a0ebcb475fb1024466c34 (diff)
downloadtqt3-fa52f57da125cb9003526976f53656197a930879.tar.gz
tqt3-fa52f57da125cb9003526976f53656197a930879.zip
Reset TQThreadInstance::currentThread() value when destroying main thread
This assures that TQRegExp who checks if there is an active thread through this interface won't try to access its already destroyed TQThreadLocalStorage, which might happen during destruction of static TQRegExp objects. Bug: https://mirror.git.trinitydesktop.org/gitea/TDE/tqt3/issues/142 Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
-rw-r--r--src/kernel/qthread_unix.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/kernel/qthread_unix.cpp b/src/kernel/qthread_unix.cpp
index 6a6f81b7..1050512a 100644
--- a/src/kernel/qthread_unix.cpp
+++ b/src/kernel/qthread_unix.cpp
@@ -183,6 +183,9 @@ void TQThreadInstance::finish( void * )
void TQThreadInstance::finishGuiThread(TQThreadInstance *d) {
TQThreadStorageData::finish( d->thread_storage );
d->thread_storage = 0;
+
+ // Let all others (namely TQRegExp) know that the main thread is no longer alive
+ setCurrentThread(0);
}
TQMutex *TQThreadInstance::mutex() const