Tk Source Code

View Ticket
Login
Ticket UUID: 7e8d67affe711114e2f4c47cb88d30e2964cc
Title: Crash closing modal window inserted by menu command
Type: Bug Version: 8.6.6 on
Submitter: jal_frezie Created on: 2017-12-23 17:10:57
Subsystem: 11. Aqua Menus Assigned To: nobody
Priority: 5 Medium Severity: Critical
Status: Closed Last Modified: 2022-04-10 20:17:02
Resolution: Invalid Closed By: chrstphrchvz
    Closed on: 2022-04-10 20:17:02
Description:

If you have a menu associated with a top-level window, and invoke a command in a cascade menu that creates a custom modal dialogue, then when you close that dialogue a system error will occur. If TclTk was compiled under MacOS Sierra or later, TclTk will exit with a console message such as:

objc[1119]: Invalid or prematurely-freed autorelease pool 0x7fb4e8000050.

(The numbers may vary). I attach a copy of the associated core dump (report.txt). If TclTk was compiled under MacOS Yosemite or earlier (e.g., the current ActiveTcl distribution, compiled under Mavericks) then a similar message is produced, such as:

objc[1112]: Invalid or prematurely-freed autorelease pool 0x7fc8d087b050. Set a breakpoint on objc_autoreleasePoolInvalid to debug. Proceeding anyway because the app is old (SDK version 10.9.0). Memory errors are likely.

And TclTk continues to run without noticeable problems. Have not tested El Capitan.

I also attach a small script (justme.tcl) that allows the problem to be reproduced -- start wish from a terminal, source the script, then click in the Tk window and choose Do -> It from the menu and hit the button on the dialogue that appears. Note that the problem does not occur if you call the procedure from the console or from a command associated with a button -- it must be from a menu on a top-level window.

User Comments: chrstphrchvz added on 2022-04-10 20:17:02:

I encountered Invalid or prematurely-freed autorelease pool errors with 8.6.12, and I find they are resolved by [d638e7ca36] (the fix for [fc5073a451]). So I wonder if maybe the underlying cause for this error persisted but the exact conditions for getting this error varied.


jal_frezie added on 2017-12-24 11:16:08:
OK, it's fixed in TclTk 8.6.8 -- my builds had been dynamic-linking to the wrong set of libraries.
I do not see it with 8.5.9 either.
Thanks for your help

kevin_walzer added on 2017-12-24 02:46:13:
I am also trying this with Wish 8.5.9 that ships with High Sierra--same results, cannot reproduce the bug.

jal_frezie added on 2017-12-23 23:39:24:
So, if I use Chrome I get tcl8.6.8-src.tar.gz and tk8.6.8-src.tar.gz which looks right.

So, I unpack those into a new folder, configure and make.

When I run tcltest or tktest and type 'info patchlevel' I still see 8.6.7

The bug is still there.

Sizes of the download files are 9793786 and 4319854 bytes.

jal_frezie added on 2017-12-23 23:15:15:
Something funny is going on...when I click those files in Safari I get tcl8.6.8rc3-src.tar and tk8.6.8rc2-src.tar in my downloads folder. Let's try another browser...

kevin_walzer added on 2017-12-23 20:15:35:
https://sourceforge.net/projects/tcl/files/Tcl/8.6.8/ has the production release, not the release candidates. 

Have you tried a clean build, i.e. not just building over the older version? Sometimes bugs linger if you do not delete the old version first. Again, I cannot reproduce this issue on my system (actually just running the latest core-8-6-branch from Fossil, from which 8.6.8 was derived).

jal_frezie added on 2017-12-23 19:03:50:
OK, tcl/tk 8.6.8 from ftp.tcl.tk reports itself to be 8.6.7 and still exhibits the bug.

Trying tcl8.6.8rc3 and tk8.6.8rc2 from Sourceforge now...these also report themselves to be 8.6.7

Bug still occurs!

Are more recent versions available anywhere?

jal_frezie added on 2017-12-23 18:29:10:
Tried with 8.6.8rc0 and that has the bug. Will try the release now

kevin_walzer added on 2017-12-23 18:10:23:
Try upgrading to 8.6.8, just released. The bug cannot be reproduced with that version. A lot of work has been done on memory management on High Sierra.

fvogel added on 2017-12-23 17:55:18:
8.6.8 that just got released has fixes in that area. Can you reproduce with 8.6.8?

jal_frezie added on 2017-12-23 17:17:43:
Note that this only happens when running in High Sierra. There is no problem running in Sierra or earlier.

Attachments: