我試圖從一個boost ::線程訪問wxDialog成員:「未處理的異常」 錯誤混合的boost ::線程時與wxWidgets的GUI
void AnotherThread(myWxDialog *dlg)
{
wxMessageBox(dlg->TextBox1->GetValue(), "It works!"); // This throws an error
}
void myWxDialog::OnButtonClick(wxCommandEvent &event)
{
boost::thread myThread(AnotherThread, this);
}
而且我得到了這個錯誤:
Unhandled exception at 0x004043d7 in MyProgram.exe: 0xC0000005: Access violation reading location 0xbaadf00d.
我覺得這種行爲在不同線程之間是不允許的。
那麼,有沒有其他的方式來做同樣的事情?
任何形式的幫助,將不勝感激。 :)
(微軟的Visual C++ 2008年速成版)
沒有GUI是線程安全的。當您嘗試時,wxWidgets會讓您的應用崩潰。 – 2010-04-08 16:17:41