From d3e21e6050fd8cfde6ff7c68d9f8dfedf7b6301f Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Tue, 16 Sep 2025 12:01:07 +0200 Subject: Add glass --- Map/Presentation/Commands/MapCommands.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Map/Presentation/Commands/MapCommands.swift') 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 -- cgit