From c82ea1fac10886a288f2ada36c8961ac4bf34eea Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Thu, 12 Jan 2023 17:19:28 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20concurrency=20crashes=20wi?= =?UTF-8?q?th=20@objc=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpmon/Common/Helpers/Application.swift | 4 ++-- phpmon/Domain/DomainList/DomainListVC+Actions.swift | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/phpmon/Common/Helpers/Application.swift b/phpmon/Common/Helpers/Application.swift index 0f1b1fe..b0f0370 100644 --- a/phpmon/Common/Helpers/Application.swift +++ b/phpmon/Common/Helpers/Application.swift @@ -33,8 +33,8 @@ class Application { Attempt to open a specific directory in the app of choice. (This will open the app if it isn't open yet.) */ - @objc public func openDirectory(file: String) async { - return await Shell.quiet("/usr/bin/open -a \"\(name)\" \"\(file)\"") + @objc public func openDirectory(file: String) { + Task { await Shell.quiet("/usr/bin/open -a \"\(name)\" \"\(file)\"") } } /** Checks if the app is installed. */ diff --git a/phpmon/Domain/DomainList/DomainListVC+Actions.swift b/phpmon/Domain/DomainList/DomainListVC+Actions.swift index 877b0b6..f12da19 100644 --- a/phpmon/Domain/DomainList/DomainListVC+Actions.swift +++ b/phpmon/Domain/DomainList/DomainListVC+Actions.swift @@ -30,17 +30,17 @@ extension DomainListVC { NSWorkspace.shared.open(url) } - @objc func openInFinder() async { - await Shell.quiet("open '\(selectedSite!.absolutePath)'") + @objc func openInFinder() { + Task { return await Shell.quiet("open '\(selectedSite!.absolutePath)'") } } - @objc func openInTerminal() async { - await Shell.quiet("open -b com.apple.terminal '\(selectedSite!.absolutePath)'") + @objc func openInTerminal() { + Task { await Shell.quiet("open -b com.apple.terminal '\(selectedSite!.absolutePath)'") } } - @objc func openWithEditor(sender: EditorMenuItem) async { + @objc func openWithEditor(sender: EditorMenuItem) { guard let editor = sender.editor else { return } - await editor.openDirectory(file: selectedSite!.absolutePath) + editor.openDirectory(file: selectedSite!.absolutePath) } // MARK: - UI interaction