wxThread::~wxThread() { #ifdef __WXDEBUG__ m_critsect.Enter(); // check that the thread either exited or couldn't be created if ( m_internal->GetState() != STATE_EXITED && m_internal->GetState() != STATE_NEW ) { wxLogDebug(_T("The thread %ld is being destroyed although it is still running! The application may crash."), (long)GetId()); } m_critsect.Leave(); #endif // __WXDEBUG__ delete m_internal; // remove this thread from the global array { wxMutexLocker lock(*gs_mutexAllThreads); gs_allThreads.Remove(this); } }