mirror of
https://github.com/python/cpython.git
synced 2025-10-17 04:08:28 +00:00
Issue #27044: stop test_idle from leaking by deleting callbacks.
This commit is contained in:
parent
b461791b91
commit
6b98ce23f6
2 changed files with 12 additions and 0 deletions
|
@ -483,6 +483,17 @@ class ConfigDialog(Toplevel):
|
||||||
self.autoSave.trace_variable('w', self.VarChanged_autoSave)
|
self.autoSave.trace_variable('w', self.VarChanged_autoSave)
|
||||||
self.encoding.trace_variable('w', self.VarChanged_encoding)
|
self.encoding.trace_variable('w', self.VarChanged_encoding)
|
||||||
|
|
||||||
|
def remove_var_callbacks(self):
|
||||||
|
"Remove callbacks to prevent memory leaks."
|
||||||
|
for var in (
|
||||||
|
self.fontSize, self.fontName, self.fontBold,
|
||||||
|
self.spaceNum, self.colour, self.builtinTheme,
|
||||||
|
self.customTheme, self.themeIsBuiltin, self.highlightTarget,
|
||||||
|
self.keyBinding, self.builtinKeys, self.customKeys,
|
||||||
|
self.keysAreBuiltin, self.winWidth, self.winHeight,
|
||||||
|
self.startupEdit, self.autoSave, self.encoding,):
|
||||||
|
var.trace_vdelete('w', var.trace_vinfo()[0][1])
|
||||||
|
|
||||||
def VarChanged_font(self, *params):
|
def VarChanged_font(self, *params):
|
||||||
'''When one font attribute changes, save them all, as they are
|
'''When one font attribute changes, save them all, as they are
|
||||||
not independent from each other. In particular, when we are
|
not independent from each other. In particular, when we are
|
||||||
|
|
|
@ -25,6 +25,7 @@ class ConfigDialogTest(unittest.TestCase):
|
||||||
|
|
||||||
def test_dialog(self):
|
def test_dialog(self):
|
||||||
d=ConfigDialog(self.root, 'Test', _utest=True)
|
d=ConfigDialog(self.root, 'Test', _utest=True)
|
||||||
|
d.remove_var_callbacks()
|
||||||
d.destroy()
|
d.destroy()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue