[wxPython-users] Bug in wx.TreeListCtrl.DeleteChildren?

Frank Niessink frank at niessink.com
Mon Dec 10 11:44:01 PST 2007


Hi Robin,

2007/12/10, Robin Dunn <robin at alldunn.com>:
> Frank Niessink wrote:
>
> > But m_curItem may point to a deleted item with a crash as result.
> >
> > Correct analysis?
>
> Yes, it looks correct to me.  So do  you think that m_curItem should
> also be set to NULL in wxTreeListItem::DeleteChildren if there is a
> matching child being deleted, or does it always need to point to a valid
> item?

I'm not sure. I'm not even sure I understand why TreeListCtrl needs
both the concept of a current item and a selected item. I don't think
the TreeCtrl makes that distinction. In my code I worked around this
bug by setting the current item to the (hidden) root item of the tree
before each update. That seems to work.

I guess the best solution is to deal with the current item in a
similar vein as the selected item is dealt with, i.e. when the current
item is about to be deleted make its parent item the new current item.

Cheers, Frank




More information about the wxpython-users mailing list