[issue39093] tkinter objects garbage collected from non-tkinter thread cause crash

2020-06-17 Thread obserience
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) {

[issue39093] tkinter objects garbage collected from non-tkinter thread cause panic and core dump

2019-12-19 Thread obserience
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

[issue39093] tkinter objects garbage collected from non-tkinter thread cause panic and core dump

2019-12-18 Thread obserience
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

[issue39093] tkinter objects garbage collected from non-tkinter thread cause panic and core dump

2019-12-18 Thread obserience
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