obserience added the comment:
I looked into this in greater depth a while back and never followed up.
In "Modules/_tkinter.c" the Tkapp_Dealloc() function has a commented out check
that would ensure it isn't called from the wrong thread.
Tkapp_Dealloc(PyObject *self)
{
obserience added the comment:
My proposed fix isn't compatible with a lot of current Tkinter using code. It
was a naive first attempt and breaks existing code and doesn't completely solve
the problem.
Variables currently retain a reference to the TCL interpreter self._tk and
are
obserience added the comment:
A quick google search for "Tcl_AsyncDelete: async handler deleted by the wrong
thread" yields plenty of users complaining about this error case. Usually
they're trying add a gui to an existing application. They run it in a thread
other than main
New submission from obserience :
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