diff options
author | Robert Schuppenies <okkotonushi@googlemail.com> | 2008-08-10 11:19:25 (GMT) |
---|---|---|
committer | Robert Schuppenies <okkotonushi@googlemail.com> | 2008-08-10 11:19:25 (GMT) |
commit | 78813dccd84c6f36fdf9d4e00b35e4f43b0867a2 (patch) | |
tree | a6b4ad4766c63dadb9aba7ae08cd72fa4b04650c | |
parent | 7641b1c94352b69318c301ab55fa408207092289 (diff) | |
download | cpython-78813dccd84c6f36fdf9d4e00b35e4f43b0867a2.zip cpython-78813dccd84c6f36fdf9d4e00b35e4f43b0867a2.tar.gz cpython-78813dccd84c6f36fdf9d4e00b35e4f43b0867a2.tar.bz2 |
Issue #1342811: Fix leak in Tkinter.Menu.delete. Commands associated to
menu entries were not deleted.
Backport from trunk r65622.
-rw-r--r-- | Lib/lib-tk/Tkinter.py | 10 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 6f00397..8874f02 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -2669,7 +2669,17 @@ class Menu(Widget): self.insert(index, 'separator', cnf or kw) def delete(self, index1, index2=None): """Delete menu items between INDEX1 and INDEX2 (not included).""" + if index2 is None: + index2 = index1 + cmds = [] + for i in range(self.index(index1), self.index(index2)+1): + if 'command' in self.entryconfig(i): + c = str(self.entrycget(i, 'command')) + if c in self._tclCommands: + cmds.append(c) self.tk.call(self._w, 'delete', index1, index2) + for c in cmds: + self.deletecommand(c) def entrycget(self, index, option): """Return the resource value of an menu item for OPTION at INDEX.""" return self.tk.call(self._w, 'entrycget', index, '-' + option) @@ -74,6 +74,9 @@ Core and builtins Library ------- +- Issue #1342811: Fix leak in Tkinter.Menu.delete. Commands associated to + menu entries were not deleted. + - Issue #799428: Fix Tkinter.Misc._nametowidget to unwrap Tcl command objects. - Issue #3339: dummy_thread.acquire() could return None which is not a valid |