TreeListCtrl crashes

Hi all,

I’m getting crashes in Task Coach on both Windows XP and Mac OSX with Python 2.5/wxPython 2.8.0.1 in the TreeListCtrl widget. If a user adds a task, then adds a subtask and then moves down with the keyboard to the new child task, a crash occurs in TreeListCtrl.GetFirstChild, see below. Strangely enough, clicking on the new child doesn’t cause a crash, and after clicking, keyboard navigation works fine.

I tried making a quick stand alone app, but wasn’t able to reproduce this.

Any ideas?

Thanks, Frank

···

Date/Time: 2007-01-22 22:48:21.053 +0100
OS Version: 10.4.8 (Build 8L2127)
Report Version: 4

Command: TaskCoach
Path: /Applications/TaskCoach.app

/Contents/MacOS/TaskCoach
Parent: WindowServer [56]

Version: 0.61.5 (0.61.5)

PID: 202
Thread: 0

Exception: EXC_BAD_ACCESS (0x0001)

Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x000000f9

Thread 0 Crashed:
0 _gizmos.so 0x14c482bf
wxTreeListMainWindow::GetFirstChild(wxTreeItemId const&, void*&) const +

51
1 _gizmos.so 0x14c5909c
wxTreeListMainWindow::OnChar(wxKeyEvent&) + 2924
2 libwx_macud-2.8.0.dylib 0x120b03b6
wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&,

wxEvtHandler*, wxEvent&) + 108
3 libwx_macud-2.8.0.dylib 0x120b10b8
wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) + 140
4 libwx_macud-2.8.0.dylib 0x120b1210
wxEvtHandler::ProcessEvent(wxEvent&) + 256



[snip long traceback]

Frank Niessink wrote:

Hi all,

I'm getting crashes in Task Coach on both Windows XP and Mac OSX with Python 2.5/wxPython 2.8.0.1 in the TreeListCtrl widget. If a user adds a task, then adds a subtask and then moves down with the keyboard to the new child task, a crash occurs in TreeListCtrl.GetFirstChild, see below. Strangely enough, clicking on the new child doesn't cause a crash, and after clicking, keyboard navigation works fine.

I tried making a quick stand alone app, but wasn't able to reproduce this.

Any ideas?

Without a way to reproduce it I can't really say what might be happening, as there are several paths from OnChar to GetFirstChild. Sorry.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Yeah, sorry about that pretty useless error report. Here’s one that’s slightly better, it has line numbers:

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000000

Thread 0 Crashed:
0 _gizmos.so 0x16607da5 wxTreeListMainWindow::GetFirstChild(wxTreeItemId const&, void*&) const + 51 (
dynarray.h:809)
1 _gizmos.so 0x1661909c wxTreeListMainWindow::OnChar(wxKeyEvent&) + 2924 (treelistctrl.cpp:3564)
2 libwx_macud-2.8.0.dylib 0x020af80e wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) + 108

3 libwx_macud-2.8.0.dylib 0x020b0510 wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) + 140
4 libwx_macud-2.8.0.dylib 0x020b0668 wxEvtHandler::ProcessEvent(wxEvent&) + 256

I’ve been going through the source code of treelistctrl.cpp and if I read the traceback above correctly the crash happens in GetFirstChild and has something to do with the array?

Here’s GetFirstChild:

#if !wxCHECK_VERSION(2, 5, 0)
wxTreeItemId wxTreeListMainWindow::GetFirstChild (const wxTreeItemId& item,

                                              long& cookie) const {

#else
wxTreeItemId wxTreeListMainWindow::GetFirstChild (const wxTreeItemId& item,
wxTreeItemIdValue& cookie) const {

#endif
wxCHECK_MSG (item.IsOk(), wxTreeItemId(), _T(“invalid tree item”));
wxArrayTreeListItems& children = ((wxTreeListItem*) item.m_pItem)->GetChildren();
cookie = 0;
return (!children.IsEmpty())? wxTreeItemId(
children.Item(0)): wxTreeItemId();
}

Could the call to GetChildren() fail if item.m_pItem is fucked up somehow?

Cheers, Frank

···

2007/1/23, Robin Dunn robin@alldunn.com:

Without a way to reproduce it I can’t really say what might be
happening, as there are several paths from OnChar to GetFirstChild. Sorry.