| Ticket UUID: | 080a28104e25e054f8f5869d9333aa57c221b896 | |||
| Title: | tk_getOpenFile crash on macOS | |||
| Type: | Bug | Version: | trunk | |
| Submitter: | anonymous | Created on: | 2025-01-08 09:49:37 | |
| Subsystem: | 37. [tk_get*File] | Assigned To: | marc_culler | |
| Priority: | 5 Medium | Severity: | Severe | |
| Status: | Closed | Last Modified: | 2025-01-24 18:58:22 | |
| Resolution: | Fixed | Closed By: | marc_culler | |
| Closed on: | 2025-01-24 18:58:22 | |||
| Description: |
The following code crash on macOS (Darwin Kernel Version 24.2.0):
package require Tk
set filename [tk_getOpenFile -filetypes {
{"Weird Text" {weird.txt}}
{"All files" {*}}
}]
It is necessary to check the value returned by typeWithFilenameExtension (https://developer.apple.com/documentation/foundation/nsmutablearray/1411274-addobject):
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -37,7 +37,8 @@ static void setAllowedFileTypes(
NSMutableArray<UTType *> *allowedTypes = [NSMutableArray array];
for (NSString *ext in extensions) {
UTType *uttype = [UTType typeWithFilenameExtension: ext];
- [allowedTypes addObject:uttype];
+ if (uttype)
+ [allowedTypes addObject:uttype];
}
[panel setAllowedContentTypes:allowedTypes];
} else {
| |||
| User Comments: |
marc_culler (claiming to be Marc Culler) added on 2025-01-24 18:58:22:
The patch and a non-regression test have been merged into trunk. marc_culler (claiming to be Marc Culler) added on 2025-01-21 15:25:00: I can reproduce this crash on macOS 15.1 with kernel 24.1.0 and I confirm that it does not occur after your patch. I will commit the change in a bugfix branch to give the CI runner a chance to check it, and work on adding a non-regression test. Your sample code should be easy to use as a test. Thanks! | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki