From b2c9cb6fd817837c98ca9cdbc4958d832f54d670 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Thu, 8 Jan 2026 21:24:30 -0800 Subject: [PATCH] =?UTF-8?q?Fix=20concurrency=20crash=20by=20running=20code?= =?UTF-8?q?=20on=20MainActor=20that=E2=80=99s=20supposed=20to=20be=20on=20?= =?UTF-8?q?MainActor.=20Fix=20#4934.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mac/Scripting/AppDelegate+Scriptability.swift | 11 ++++++----- iOS/SceneDelegate.swift | 10 ++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Mac/Scripting/AppDelegate+Scriptability.swift b/Mac/Scripting/AppDelegate+Scriptability.swift index d48d78c93..3769b819d 100644 --- a/Mac/Scripting/AppDelegate+Scriptability.swift +++ b/Mac/Scripting/AppDelegate+Scriptability.swift @@ -65,16 +65,17 @@ extension AppDelegate: AppDelegateAppleEvents { return } - do { - try ArticleThemeDownloader.shared.handleFile(at: location) - } catch { - NotificationCenter.default.post(name: .didFailToImportThemeWithError, object: nil, userInfo: ["error": error]) + Task { @MainActor in + do { + try ArticleThemeDownloader.shared.handleFile(at: location) + } catch { + NotificationCenter.default.post(name: .didFailToImportThemeWithError, object: nil, userInfo: ["error": error]) + } } } task.resume() } return - } // Special case URL with specific scheme handler x-netnewswire-feed: intended to ensure we open diff --git a/iOS/SceneDelegate.swift b/iOS/SceneDelegate.swift index 7f27b2d82..b03aed97b 100644 --- a/iOS/SceneDelegate.swift +++ b/iOS/SceneDelegate.swift @@ -206,10 +206,12 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate { guard let location = location else { return } - do { - try ArticleThemeDownloader.shared.handleFile(at: location) - } catch { - NotificationCenter.default.post(name: .didFailToImportThemeWithError, object: nil, userInfo: ["error": error]) + Task { @MainActor in + do { + try ArticleThemeDownloader.shared.handleFile(at: location) + } catch { + NotificationCenter.default.post(name: .didFailToImportThemeWithError, object: nil, userInfo: ["error": error]) + } } } task.resume()