I discovered a bug in the ListCtrl image and just want to
check that it hasn't been fixed before posting it to the bug
tracker. If you create a wxImageList in local scope (without keeping
a reference around through the lifetime of the object) and then do
a list.SetImageList, once the image list goes out of scope (at the
and of the block), the image list is mistakenly destroyed, causing
the window to segfault upon display. It's probably a ref counting
problem, where the image reference wasn't increments during the
SetImageList call. I can draft up an example if need be, but I think
the description pretty much covers it. Any thoughts?
I discovered a bug in the ListCtrl image and just want to
check that it hasn't been fixed before posting it to the bug
tracker. If you create a wxImageList in local scope (without keeping
a reference around through the lifetime of the object) and then do
a list.SetImageList, once the image list goes out of scope (at the
and of the block), the image list is mistakenly destroyed, causing
It's not a mistake. The image list is designed to be shared amonst objects and so none of them take ownership of it. In Python this means that it is destroyed when its last reference goes away.
the window to segfault upon display. It's probably a ref counting
problem, where the image reference wasn't increments during the
SetImageList call. I can draft up an example if need be, but I think
the description pretty much covers it. Any thoughts?
There is no need as there is already a method to change the semantics. If you use AssignImageList instead of SetImageList then the control will take ownership of the list and will destroy it when appropriate.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!