[wxPython-dev] Problem with MenuItem.Destroy()

Werner F. Bruhin werner.bruhin at free.fr
Mon Dec 18 10:30:09 PST 2006


Hi Paul,

Paul McNett wrote:
> Paul McNett wrote:
>> Sorry, I don't have time right now to build and test with the 
>> preview, but this happens in wxPython 2.7.2 at least.
>>
>> Modify the example for Menu.py as follows:
>>
>> --- Menu.py.orig        2006-12-08 11:49:41.000000000 -0800
>> +++ Menu.py     2006-12-08 11:48:39.000000000 -0800
>> @@ -81,6 +81,8 @@
>>          item = wx.MenuItem(menu5, 500, "&Smile!\tCtrl+S", "This one 
>> has an icon")
>>          item.SetBitmap(images.getSmilesBitmap())
>>          menu5.AppendItem(item)
>> +        menu5.RemoveItem(item)
>> +        item.Destroy()
>>
>>          # Shortcuts
>>          menu5.Append(501, "Interesting thing\tCtrl+A", "Note the 
>> shortcut!")
>>
>>
>> The call to item.Destroy() causes a segfault. This wasn't the case in 
>> wx2.6.
>
> Is nobody able to reproduce this? I'm wondering if this is a new class 
> of problems in wx2.7 because I'm getting segfaults and illegal 
> operations in various places - this was just one place I tracked down. 
> It is keeping Dabo from being able to announce support for wx2.7/2.8.
>
> I'll try to get some time to compile and test with the latest preview 
> sometime soon, but in the meantime can somebody confirm/deny the 
> existence of the problem with wx.MenuItem.Destroy()?
Just tried it in wxPython 2.8.0.1, it crashes for me too.  Actually 
Visual Studio Just in Time debugger comes up (I am trying it out for 
some Mobile dev) with the error "an unhandled win32 exception occurred 
in pythonw.exe".

Werner





More information about the wxpython-dev mailing list