mirror of
https://github.com/python/cpython.git
synced 2026-10-28 18:35:21 +08:00
gh-69365: Fix reference leak in IDLE search dialogs (GH-157754)
Remove the variable trace that clears the error label when the label is destroyed, so that it does not keep the dialog alive.
This commit is contained in:
1 parent
76f22f9cf2
commit
b4067cd6e8
1 file changed
+5
-1
@@ -139,7 +139,11 @@ class SearchDialogBase:
|
||||
self.error_label = Label(self.frame, text=' ', foreground='red')
|
||||
self.error_label.grid(row=self.row, column=1, sticky="nw")
|
||||
self.row = self.row + 1
|
||||
self.engine.patvar.trace_add('write', lambda *args: self.show_error(''))
|
||||
patvar = self.engine.patvar
|
||||
trace = patvar.trace_add('write', lambda *args: self.show_error(''))
|
||||
# The trace holds the dialog, remove it with the label.
|
||||
self.error_label.bind('<Destroy>',
|
||||
lambda e: patvar.trace_remove('write', trace))
|
||||
|
||||
def make_frame(self,labeltext=None):
|
||||
'''Return (frame, label).
|
||||
|
||||
Reference in new issue
Block a user