This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author obserience
Recipients obserience
Date 2019-12-19.02:56:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1576724216.68.0.395572121912.issue39093@roundup.psfhosted.org>
In-reply-to
Content
All tkinter objects have a reference to the TCL interpreter object "self.tk". The current cleanup code does not remove these when a widget is destroyed.

Garbage collection of the TCL interpreter object occurs only after all gui objects are garbage collected. This may  be triggered from another thread causing TCL to panic and trigger a core dump.

Error message:
>Tcl_AsyncDelete: async handler deleted by the wrong thread
>Aborted (core dumped)

Adding:
"self.tk = None"
to the end of Misc.destroy() (tkinter/__init__.py line:439) should fix this by removing these reference when widgets are destroyed. (Note:destroy is recursive on the widget tree and called on the root object when a Tkinter GUI exits)

I can't see any problem with removing the interpreter object from a widget when it is destroyed. There doesn't seem to be any way to reassign a widget to a new parent so this shouldn't affect anything.

Doing this makes it safe(r) to use tkinter from a non-main thread since if the GUI cleans up properly no "landmines" are left to cause a crash when garbage collected in the wrong thread.
History
Date User Action Args
2019-12-19 02:56:56obseriencesetrecipients: + obserience
2019-12-19 02:56:56obseriencesetmessageid: <1576724216.68.0.395572121912.issue39093@roundup.psfhosted.org>
2019-12-19 02:56:56obseriencelinkissue39093 messages
2019-12-19 02:56:55obseriencecreate