Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 63063af + 6b98ce2 commit ef20cbfCopy full SHA for ef20cbf
2 files changed
Lib/idlelib/configDialog.py
@@ -483,6 +483,17 @@ def AttachVarCallbacks(self):
483
self.autoSave.trace_variable('w', self.VarChanged_autoSave)
484
self.encoding.trace_variable('w', self.VarChanged_encoding)
485
486
+ def remove_var_callbacks(self):
487
+ "Remove callbacks to prevent memory leaks."
488
+ for var in (
489
+ self.fontSize, self.fontName, self.fontBold,
490
+ self.spaceNum, self.colour, self.builtinTheme,
491
+ self.customTheme, self.themeIsBuiltin, self.highlightTarget,
492
+ self.keyBinding, self.builtinKeys, self.customKeys,
493
+ self.keysAreBuiltin, self.winWidth, self.winHeight,
494
+ self.startupEdit, self.autoSave, self.encoding,):
495
+ var.trace_vdelete('w', var.trace_vinfo()[0][1])
496
+
497
def VarChanged_font(self, *params):
498
'''When one font attribute changes, save them all, as they are
499
not independent from each other. In particular, when we are
Lib/idlelib/idle_test/test_configdialog.py
@@ -25,6 +25,7 @@ def tearDownClass(cls):
25
26
def test_dialog(self):
27
d=ConfigDialog(self.root, 'Test', _utest=True)
28
+ d.remove_var_callbacks()
29
d.destroy()
30
31
0 commit comments