【问题标题】:wxWidgets debug assertion failed, xtree not deferencable, when modifying wxTextCtrl valuewxWidgets 调试断言失败,xtree 不可延迟,当修改 wxTextCtrl 值时
【发布时间】:2014-10-22 07:50:11
【问题描述】:

当我输入一个 wxDialog 并聚焦一个 wxTextCtrl 时,没有什么不好的事情发生,但是一旦我修改了该文本中的某些内容,例如删除一个字符,应用程序就会崩溃并显示以下消息:

“调试断言失败:map/set iterator not 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,然后崩溃。

【问题讨论】:

    标签: c++ wxwidgets


    【解决方案1】:

    问题来自另一个代码修改,我仍然不知道它是如何产生这种效果的。 wxWidgets 库的内部行为可能是什么?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-24
      • 2015-06-27
      • 1970-01-01
      相关资源
      最近更新 更多