0
當我進入一個wxDialog,我集中一個wxTextCtrl沒有壞事發生,但只要我修改該文本中的東西,如刪除一個字符,應用程序崩潰與此消息:wxWidgets調試斷言失敗,xtree不可忽略,當修改wxTextCtrl值
「調試斷言失敗:地圖/套迭代器不dereferencable」
我找到了最後一個方法崩潰之前稱這是一個:
bool wxWindowMSW::HandleKillFocus(WXHWND hwnd)
{
#if wxUSE_CARET
// Deal with caret
if (m_caret)
{
m_caret->OnKillFocus();
}
#endif // wxUSE_CARET
#if wxUSE_TEXTCTRL
// If it's a wxTextCtrl don't send the event as it will be done
// after the control gets to process it.
wxTextCtrl *ctrl = wxDynamicCastThis(wxTextCtrl);
if (ctrl)
{
return false;
}
#endif
// Don't send the event when in the process of being deleted. This can
// only cause problems if the event handler tries to access the object.
if (m_isBeingDeleted)
{
return false;
}
wxFocusEvent event(wxEVT_KILL_FOCUS, m_windowId);
event.SetEventObject(this);
// wxFindWinFromHandle() may return NULL, it is ok
event.SetWindow(wxFindWinFromHandle(hwnd));
return GetEventHandler()->ProcessEvent(event);
}
運行應用程序時,這種方法叫做 多次; ctrl的值始終爲0x00000000,因此不會在第一個IF子句中返回false。 在對話框內並修改文本時,ctrl的值變爲實數值0x031194b0;那麼它將進入IF子句,返回false並崩潰。