Message358685
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 aren't linked into the widget tree or otherwise accessible to any cleanup logic.
Existing code:
-may expect the self.tk attribute of destroyed widgets to still be set
Existing code (after calling root.destroy()):
-calls methods like Tk.quit() which runs Tcl commands requiring self.tk to still be there
--Idle does this "# (Needed for clean exit on Windows 98)" <--apparently
---is this still the case??
-may call get() and set() on Variable instances (this currently works)
Given this it might be better to track all references to the TCL interpreter in a separate data structure and add a Tk.cleanup() method that gets rid of them all with documentation indicating all calls after this will fail. Alternate implementation of this deallocates the TCL interpreter in the _tkinter.c bindings with the same results.
One of the core issues here is that the cause of the crash is asynchronous signal handlers installed by the TCL library and necessary for the TCL interpreter to run at all. If you can run TCL commands, the crash can still be triggered.
###separate issue###
The Tk.Quit() doc is wrong. Current inline docs say that it destroys all widgets, which it does not. All it seems to do is cause mainloop to return after which mainloop can be called again and the GUI resumes functioning. This has caused problems when the main thread doesn't exit since the GUI continues to exist but is frozen. (See quit_behavior.py) |
|
Date |
User |
Action |
Args |
2019-12-19 16:36:27 | obserience | set | recipients:
+ obserience, gpolo, serhiy.storchaka |
2019-12-19 16:36:27 | obserience | set | messageid: <1576773387.52.0.231612141338.issue39093@roundup.psfhosted.org> |
2019-12-19 16:36:27 | obserience | link | issue39093 messages |
2019-12-19 16:36:25 | obserience | create | |
|