diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-09-16 12:01:07 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-09-16 12:01:07 +0200 |
| commit | d3e21e6050fd8cfde6ff7c68d9f8dfedf7b6301f (patch) | |
| tree | 3e9d76f8f4be7febedbd1dac01f1adc1c4c1b7db /Map/Presentation/Commands/MapCommands.swift | |
| parent | 45e5a80ae378a72720114641c39148c199c6332d (diff) | |
Add glass
Diffstat (limited to 'Map/Presentation/Commands/MapCommands.swift')
| -rw-r--r-- | Map/Presentation/Commands/MapCommands.swift | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Map/Presentation/Commands/MapCommands.swift b/Map/Presentation/Commands/MapCommands.swift index a298956..fe21f57 100644 --- a/Map/Presentation/Commands/MapCommands.swift +++ b/Map/Presentation/Commands/MapCommands.swift @@ -62,6 +62,9 @@ struct MapCommands: Commands { Button("commands.file.export") { if let selectedEvolution, let document { if let image = document.exportAsImage(withEvolution: selectedEvolution) { + + // Capture image data to avoid sendability issues with NSImage + guard let tiffData = image.tiffRepresentation else { return } let filename = url?.deletingPathExtension().lastPathComponent ?? "Untitled" @@ -154,9 +157,11 @@ struct MapCommands: Commands { savePanel.accessoryView = accessoryController.view savePanel.begin { result in - if result == .OK, let url = savePanel.url { - if let tiffRepresentation = image.tiffRepresentation { - let bitmapImage = NSBitmapImageRep(data: tiffRepresentation) + if result == .OK { + let bitmapImage = NSBitmapImageRep(data: tiffData) + + Task { @MainActor in + guard let url = savePanel.url else { return } let selectedFormat = formats[accessoryController.formatPopup.indexOfSelectedItem] // Generate data based on selected format |