]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 1336712 ] Fix segfault when calling wxThread::Exit()
authorJulian Smart <julian@anthemion.co.uk>
Tue, 17 Jan 2006 19:17:40 +0000 (19:17 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 17 Jan 2006 19:17:40 +0000 (19:17 +0000)
By bdonner

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36939 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/unix/threadpsx.cpp

index 2eb63474f914f0ea0ec82daabd9a594e56977c37..d1a8b82f60e5bba27adf8fdc5be592782975541c 100644 (file)
@@ -818,6 +818,7 @@ extern "C" void wxPthreadCleanup(void *ptr)
 
 void wxThreadInternal::Cleanup(wxThread *thread)
 {
+    if (pthread_getspecific(gs_keySelf) == 0) return;
     {
         wxCriticalSectionLocker lock(thread->m_critsect);
         if ( thread->m_internal->GetState() == STATE_EXITED )
@@ -1481,6 +1482,7 @@ void wxThread::Exit(ExitCode status)
         //       we make it a global object, but this would mean that we can
         //       only call one thread function at a time :-(
         DeleteThread(this);
+        pthread_setspecific(gs_keySelf, 0);
     }
     else
     {