Tk Source Code

View Ticket
Login
Ticket UUID: 5441403d4da062b8f6b98d6f4cf8f8717d34f83b
Title: Random semantic color values on macOS 10.15.6 Catalina
Type: Bug Version: trunk
Submitter: nemethi Created on: 2025-11-28 10:50:44
Subsystem: 66. Aqua Window Operations Assigned To: marc_culler
Priority: 5 Medium Severity: Severe
Status: Closed Last Modified: 2026-02-02 16:38:57
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-02-02 16:38:57
Description:

Run the following test script with Tk built from trunk on macOS 10.15.6 Catalina:

lassign [winfo rgb . systemLabelColor] r g b
puts [format "#%02x%02x%02x" [expr {$r >> 8}] [expr {$g >> 8}] [expr {$b >> 8}]]

The output is a random value, e.g., #a63000, instead of the expected #000000 in light mode and #ffffff in dark mode.

This bug seems to be Catalina-specific, and other semantic colors are affected by it, too.  On the latest macOS version 15.6 the script works as expected.

This ticket is similar to 23b57a7214.  Apparently, the fix made over a year ago doesn't cover all macOS versions.

User Comments: nemethi (claiming to be Csaba Nemethi) added on 2025-12-17 15:35:00:

The fix is now in main and core-9-0-branch, see the commits [a8d49cda] and [948c7e18].

I will close the ticket as soon as the Tk CI on Github works again. The branch "bug-5441403d-chavez" is already closed.


chrstphrchvz added on 2025-12-16 19:23:17:

Yes, please go ahead and merge the bug fix branch. No need to leave this ticket open. Thanks


nemethi (claiming to be Csaba Nemethi) added on 2025-12-16 13:46:56:

Christopher, this ticket is nearly three weeks old. Taking into account that your fix made in the "bug-5441403d-chavez" branch works both on macOS 10.15.6 Catalina and on current macOS versions, I think now it is time to merge that branch into core-9-0-branch and trunk. With this step we could set the resolution to "Fixed". We can keep the "Open" status if you wish (being that your preferred solution is the one in the "patch-3a4310ee16" branch), but it would be important to have this bug fixed in Tk 9.1a1 (which is scheduled for release in January 2026).

Shall I merge the "bug-5441403d-chavez" branch for you?


nemethi (claiming to be Csaba Nemethi) added on 2025-11-30 13:26:32:

With NSZombieEnabled=YES I get the error message

2025-11-30 13:31:08.388 Wish[27824:170279] *** -[NSCompositeAppearance retain]: message sent to deallocated instance 0x7fba3d57d410
/Users/csaba/bin/wish_trunk: line 2: 27824 Illegal instruction: 4  $HOME/tcltk/trunk/emb/Applications/Utilities/Wish.app/Contents/MacOS/Wish "$@"

The workaround in your latest commit to the "patch-3a4310ee16" branch prevents the crash.


chrstphrchvz added on 2025-11-30 05:14:37:

Csaba, regarding the patch-3a4310ee16 crash, I wonder if you get an error message when running the app with the environment variable NSZombieEnabled=YES, and whether the workaround in [11e6782c] prevents the crash.


nemethi (claiming to be Csaba Nemethi) added on 2025-11-29 20:00:13:

Christopher, many thanks again for your fix in the "bug-5441403d-chavez" branch! Now I have tested it successfully on the latest macOS version 15.6, too.


chrstphrchvz added on 2025-11-29 18:20:48:

Csaba, thanks for the steps on how to trigger the crash. By using similar steps, I can trigger a crash in wish. I will discuss this further on [3a4310ee].


chrstphrchvz added on 2025-11-29 17:26:02:

Yes, I have a Mac running Catalina.


nemethi (claiming to be Csaba Nemethi) added on 2025-11-29 15:52:16:

Christofer, many thanks for your fix in the "bug-5441403d-chavez" branch! I have successfully tested it on macOS 10.15.6 Catalina. I will test it on the latest macOS version 15.6, too, although I am confident that you have already run the test yourself.

Regarding the crash with the "patch-3a4310ee16" branch: The application that crashes has some SVG images, whose colors depend on the current theme and appearance. I started it in the light mode, then switched to dark mode using the System Settings, and then changed the accent color, again via the System Settings. This last step resulted in a crash. The application changes the colors of the images whenever it receives a <<ThemeChanged>>, <<LightAqua>>, or <<DarkAqua>> event.

Do you have access to a Mac running macOS 10.15.6 Catalina?


chrstphrchvz added on 2025-11-29 00:52:04:

Csaba, thanks for trying out the changes from patch-3a4310ee16. Sorry to hear that there are crashes; I don’t think I have encountered any myself, so I look forward to any additional info you can share regarding them.

I have come up with a simpler fix just for this ticket’s issue, please see branch bug-5441403d-chavez


nemethi (claiming to be Csaba Nemethi) added on 2025-11-28 20:13:24:

Thanks Christofer, I have merged that brach into trunk (w/o doing any commits) and rebuilt Tk from the patched version. The reported bug was no longer present, but, unfortunately, I have experienced crashes with segmentation fault in dark mode.


chrstphrchvz added on 2025-11-28 17:05:27:

I wonder if the patch-3a4310ee16 branch fixes this, even though a simpler fix might still be possible in the meantime.