Problem with wx.ListCtrl and GetItemImage

Here is a simple test case of my problem: http://rafb.net/paste/results/ZYlmpi33.html

Line 37 causes python to crash. If I comment it, it works fine. What am I doing wrong?

Adam Olsen wrote:

Here is a simple test case of my problem: http://rafb.net/paste/results/ZYlmpi33.html

Line 37 causes python to crash. If I comment it, it works fine. What am I doing wrong?

SetImageList doesn't take ownership of the image list, and assumes that the image list will continue to exist for as long as it needs it. But you are not saving a reference to it so it is being destroyed at the end of the function. So you either need to save a reference to it or you need to use AssignImageList so the listctrl will take ownership.

ยทยทยท

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