Tk Source Code

View Ticket
Login
Ticket UUID: 7ee2ae8f42a9b848bb51a58bc6e86a619dee8527
Title: Possible crash when moving mouse pointer in and out of window with tk 9.1a0 on macOS 13.2
Type: Bug Version: 9.1a0
Submitter: EricBrunel Created on: 2025-03-12 14:59:33
Subsystem: 66. Aqua Window Operations Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2025-03-13 14:35:49
Resolution: None Closed By: EricBrunel
    Closed on: 2025-03-13 14:35:49
Description:

I'm using tcl/tk built from the latest version of the source code on a Mac mini with macOS 13.2. When I run this very simple script:

pack [ttk::label .lbl -text Test] -side top

and then move the mouse pointer in and out of the window, I sometimes get a crash with a "segmentation fault" error message. I'm attaching the full log displayed after the crash.

The crash does not happen if I run wish in lldb. It also doesn't happen systematically, but it seems that it mostly does during the first runs after a restart of the mac. And if I get it to work once - e.g. after running it in lldb -, after that, it seems to keep working until I turn off the Mac. But if I turn it back on and test again, I'm highly likely to get the crash again.

User Comments: EricBrunel added on 2025-03-13 14:35:49:

And it looks like you're right: I upgraded macOS on my mac mini to version 13.7.2, and it looks like the problem is gone. I can run the script and move the mouse pointer in and out of it, no problem at all. I also had this problem on a big application using tcl/tk that we're developing at work, which is where I saw the problem in the first place, but it's gone there too: the crash was happening very easily, but now I couldn't find a way to make it happen.

Closing the ticket.


marc_culler (claiming to be Marc Culler) added on 2025-03-13 03:19:03:
Hi Eric,

I rebooted my macOS 15.3 M1 mac mini and ran your one line script in Wish.
I was not able to produce a crash by moving the mouse pointer in and out of
the window.

Looking at your crash log I see that the last call to a Tcl or Tk function
was 13 stack frames above the crash.  And that was just the usual call to
the checkproc to process the mouse events you are generating by moving the
pointer around.  It appears that the crash occurs when macOS is trying to
render the special cursor for resizing a window by dragging an edge.  That
cursor should appear as you move the mouse pointer over the edge of the
window.  Once the image has been cached by the OS the crash stops happening.
It may be a race condition, so changing some timing by running wish in
lldb leads to a different outcome of the race, so the image gets cached,
and the crash goes away.

Honestly, this looks like an Apple bug (yes, they do exist, even if the bug
reports are kept strictly private).  Based on my inability to reproduce the
crash on macOS 15, it seems possible that it might have gotten fixed in
macOS 14 or 15.

Attachments: