Applied patch [ 1336712 ] Fix segfault when calling wxThread::Exit()

By bdonner


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36939 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2006-01-17 19:17:40 +00:00
parent 8db1a709bc
commit b486658282

View File

@ -818,6 +818,7 @@ extern "C" void wxPthreadCleanup(void *ptr)
void wxThreadInternal::Cleanup(wxThread *thread) void wxThreadInternal::Cleanup(wxThread *thread)
{ {
if (pthread_getspecific(gs_keySelf) == 0) return;
{ {
wxCriticalSectionLocker lock(thread->m_critsect); wxCriticalSectionLocker lock(thread->m_critsect);
if ( thread->m_internal->GetState() == STATE_EXITED ) 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 // we make it a global object, but this would mean that we can
// only call one thread function at a time :-( // only call one thread function at a time :-(
DeleteThread(this); DeleteThread(this);
pthread_setspecific(gs_keySelf, 0);
} }
else else
{ {