Reset m_lastItem to avoid crashes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20407 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2003-05-01 15:38:55 +00:00
parent 3e3a7b97ec
commit 1cf1238db4
2 changed files with 4 additions and 1 deletions

View File

@ -836,6 +836,7 @@ void MyTreeCtrl::DoToggleIcon(const wxTreeItemId& item)
void MyTreeCtrl::name(wxTreeEvent& event) \
{ \
wxLogMessage(wxT(#name)); \
SetLastItem(wxTreeItemId()); \
event.Skip(); \
}

View File

@ -97,7 +97,7 @@ public:
void DoSortChildren(const wxTreeItemId& item, bool reverse = FALSE)
{ m_reverseSort = reverse; wxTreeCtrl::SortChildren(item); }
void DoEnsureVisible() { EnsureVisible(m_lastItem); }
void DoEnsureVisible() { if (m_lastItem.IsOk()) EnsureVisible(m_lastItem); }
void DoToggleIcon(const wxTreeItemId& item);
@ -105,6 +105,8 @@ public:
int ImageSize(void) const { return m_imageSize; }
void SetLastItem(wxTreeItemId id) { m_lastItem = id; }
protected:
virtual int OnCompareItems(const wxTreeItemId& i1, const wxTreeItemId& i2);