From: <chr...@gm...> - 2023-08-12 08:33:39
|
On 8/12/23 at 2:23 AM, Aivar Annamaa wrote: > Hi! > > My Tkinter application (using Tk 8.6.13) uses two independent windows > during first run -- if it sees the configuration file is missing, it first > presents a small window (an instance of tkinter.Tk) for collecting a couple > of user preferences, then closes it and only then presents the main window > (another tkinter.Tk). > > In Linux and Windows this works nicely, but in macOS (e.g. Intel Catalina > or Arm Ventura), when two windows are used like this, the process crashes > with segmentation fault when the user opens a menu or invokes a file dialog > in the main window. Here is the Python fault report: > https://pastebin.com/pjiCVamm and this is macOS report: > https://pastebin.com/isaNMb5V > > I've considered restarting the process after creating the configuration > file (thus using single mainloop per process), but it would be an extra > hassle. > > Any ideas how to overcome problem this without changing the overall > approach? I tried assigning different window classes for each window but it > didn't help. > > Best regards, > Aivar Hello Aivar, This crash has been reported previously, including by many Tkinter users. I posted an explanation of this crash and a proposed fix for it at https://core.tcl-lang.org/tk/info/ef5d3e29a4 however it has yet to be reviewed by the Tk Aqua developers. Although some users have reported workarounds for this issue, I am not certain how reliable they actually are, or whether they apply to your use case. However, what I do know is that this issue can only occur once the first created root/main window, i.e. the first tkinter.Tk() instance, is destroyed. So the workaround I might suggest is to create only one tkinter.Tk() instance, and then use it to create additional Toplevels as needed, rather than creating new tkinter.Tk() instances. Also, as I have said to others who posted here, the tcl-mac list is far less popular than it once was, and I would not recommend using it due to the likelihood of posts going unnoticed. Hope this helps, Christopher A. Chavez |