TreeListCtrl crash with EditLabel()

I am having problems with EditLabel() in TreeListCtrl. Editing the
text causes the program to crash. Here is a test case:

import wx, wx.gizmos
app = wx.PySimpleApp()
frame = wx.Frame(None)
tree = wx.gizmos.TreeListCtrl(frame, style = wx.TR_DEFAULT_STYLE |
wx.TR_HIDE_ROOT)
tree.AddColumn("Test")
root = tree.AddRoot("root")
item = tree.AppendItem(root, "foo")
tree.EditLabel(item, 0)
frame.Show()
app.MainLoop()

If you enter some text and click somewhere else it will crash. The
enter key doesn't work either. If you click somewhere else without
changing the text it doesn't crash.

Is TreeListCtrl considered stable code, or should I forget about it
and roll my own?

Luke McCarthy wrote:

I am having problems with EditLabel() in TreeListCtrl. Editing the
text causes the program to crash. Here is a test case:

import wx, wx.gizmos
app = wx.PySimpleApp()
frame = wx.Frame(None)
tree = wx.gizmos.TreeListCtrl(frame, style = wx.TR_DEFAULT_STYLE |
wx.TR_HIDE_ROOT)
tree.AddColumn("Test")
root = tree.AddRoot("root")
item = tree.AppendItem(root, "foo")
tree.EditLabel(item, 0)
frame.Show()
app.MainLoop()

If you enter some text and click somewhere else it will crash. The
enter key doesn't work either. If you click somewhere else without
changing the text it doesn't crash.

Confirmed. Looks like the text widget is being destroyed while there are still events pending for it.

Is TreeListCtrl considered stable code, or should I forget about it
and roll my own?

Well, it's stable in the sense that the API isn't changing, but it's also mostly unmaintained. Go ahead and file a ticket about this and I'll see if I can find time to dig into it. In the meantime there is Andrea's HyperTreeList widget, and in 2.9 we'll have the dataview controls that can also be used like a treelistctrl.

···

--
Robin Dunn
Software Craftsman

Well, it's stable in the sense that the API isn't changing, but it's
also mostly unmaintained. Go ahead and file a ticket about this and
I'll see if I can find time to dig into it. In the meantime there is
Andrea's HyperTreeList widget, and in 2.9 we'll have the dataview
controls that can also be used like a treelistctrl.

Thanks, I wasn't aware of HyperTreeList, it works just fine as a drop-
in replacement.