[New-bugs-announce] [issue6270] Menu deletecommand fails if command is already deleted
Greg Couch
report at bugs.python.org
Thu Jun 11 23:09:40 CEST 2009
New submission from Greg Couch <gregc at cgl.ucsf.edu>:
Sometime around Python 2.5.4, Menu.delete was changed to delete
associated entry commands (and thus plug a memory leak). This broke
Pmw.OptionMenu because it already had similar code, so when Menu.delete
was called, the commands were already gone, and a TclError was raised
saying "can't delete Tcl command".
While Pmw could be patched to workaround this bug, it seems strange that
Tkinter.Misc.deletecommand unconditionally deletes commands it knows
nothing about. All uses of deletecommand in Tkinter refer to commands
that were Tkinter.Misc._register'ed, so they should appear in the
widget._tclCommands list. So the proper solution is to only delete
commands that are still registered with the widget.
Repeat by:
import Pmw
om = Pmw.OptionMenu()
om.pack()
om.setitems(['a', 'b'])
om.setitems(['b'])
----------
components: Tkinter
files: delcmd.patch
keywords: patch
messages: 89262
nosy: gregcouch
severity: normal
status: open
title: Menu deletecommand fails if command is already deleted
type: crash
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file14265/delcmd.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6270>
_______________________________________
More information about the New-bugs-announce
mailing list