| Ticket UUID: | ec2dcb36ca9967e8940dc400d3e2a053c723e13a | |||
| Title: | Tk 9.0.1 crash when resizing a window with a ttk::panedwidget containing a ttk::button on macOS 10.13 | |||
| Type: | Bug | Version: | 9.0.1 | |
| Submitter: | EricBrunel | Created on: | 2025-03-05 15:56:03 | |
| Subsystem: | 66. Aqua Window Operations | Assigned To: | marc_culler | |
| Priority: | 5 Medium | Severity: | Important | |
| Status: | Closed | Last Modified: | 2025-03-08 16:42:14 | |
| Resolution: | Fixed | Closed By: | marc_culler | |
| Closed on: | 2025-03-08 16:42:14 | |||
| Description: |
With tcl/tk 9.0.1 built from the source code on macOS 10.13 with the patch correcting the build issue in ticket cb5d776b12, run the following script:
Then resize the window from its right side until the button in the left pane disappears. This causes a crash with the message:
This does not seem to happen on more recent versions of macOS: on a build with the same sources on macOS 13.2, the problem does not happen. | |||
| User Comments: |
marc_culler (claiming to be Marc Culler) added on 2025-03-08 16:42:14:
Hi Eric. Thanks for noticing that. I removed that redundant (and wrong) code from DrawGrayButton. EricBrunel added on 2025-03-08 08:29:30: I did test on my iMac with macOS 10.13, and I confirm that everything works fine now. Thanks a lot! By the way, the radius set to -1 might require another little adjustment: in file marc_culler (claiming to be Marc Culler) added on 2025-03-08 03:10:37: I checked this on a macOS 10.13 VM and it seemed fine. I think that is enough insurance to close the ticket. marc_culler (claiming to be Marc Culler) added on 2025-03-07 14:46:41: Eric, Would you please test one more time, just to make sure? Thanks. marc_culler (claiming to be Marc Culler) added on 2025-03-07 14:27:10: Hi Eric,
Thank you very much!
Most of the time the radius is provided by a ButtonDesign defined in
ttkMacOSXTheme.h and all of those set the radius to a non-negative
value. I did find one place where the radius could get computed in
terms of the button height:
CGFloat radius = 2 * design->radius <= bounds.size.height ?
design->radius : bounds.size.height / 2;
I can only guess that some quirk of macOS 10.13 causes the button
height to be negative.
Question: When you say that the radius was -1 did you mean -1.0 (since
radius is a float) or did the radius somehow get cast to an int with
value -1?
Anyway, your suggestion looks good and I will add it to the bugfix
branch.
EricBrunel added on 2025-03-07 09:04:14: Thanks for looking into it, Marc. Unfortunately, I tested the code on the branch, and I'm still getting a crash. I did a few tests and I narrowed it down to the call to
I don't get a crash anymore. Thanks again! marc_culler (claiming to be Marc Culler) added on 2025-03-07 01:08:59: Well, it turned out that there were several calls to CGPathCreateFromRoundedRect which were not protected by checks that the corner radius was less than half the side length. I created a bugfix branch bug-ec2dcb36c which adds checks to all of those calls. Eric, can you please test that branch on your High Sierra system? (Not all OS releases crash when that rule is broken. Some just correct the radius.) marc_culler (claiming to be Marc Culler) added on 2025-03-06 23:03:45: That assertion is checking that there is a linear segment of positive length on each side of the rounded rectangle. In many cases we chack for that and use a normal rectangle when the bounds are too small to accomodate corners. I thought we were doing that in all cases, but apparently one was missed. It would be nice to know that it is really Tk that is generating this, rather than the HITheme library which is used for drawing older versions of native widgets. If you could generate the crash after replacing Tk by Tk_debug and upload the crash report I could probably find where the problem is. | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki