2014-10-22 36 views
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并崩溃。

回答

0

问题来自另一个代码修改,我仍然没有找到它如何可以产生这种效果。 wxWidgets库的内部行为可能?