Ok, I find the reason, we only need Wait(). (We don't need Delete()), otherwise, we try to delete the thread twice.
// class destructor
ClassBrowser::~ClassBrowser()
{
int pos = XRCCTRL(*this, "splitterWin", wxSplitterWindow)->GetSashPosition();
Manager::Get()->GetConfigManager(_T("code_completion"))->Write(_T("/splitter_pos"), pos);
SetParser(NULL);
if (m_BuilderThread)
{
m_Semaphore.Post();
//m_BuilderThread->Delete();
m_BuilderThread->Wait();
delete m_BuilderThread;
m_BuilderThread=0;
}
}
It works OK.