Skip to content

fix(SparkleUpdateController): stop the background task tripping an executor check (refs #289) - #291

Open
bcupello wants to merge 1 commit into
MythicApp:mainfrom
bcupello:fix/sparkle-launch-trap
Open

bcupello wants to merge 1 commit into
MythicApp:mainfrom
bcupello:fix/sparkle-launch-trap

Conversation

@bcupello

Copy link
Copy Markdown

The closure handed to backgroundQueue.schedule is non-Sendable, so under Swift 6 it inherits the enclosing MainActor isolation and the compiler emits an executor check at its entry. It then runs on backgroundQueue, where that check fails.

On Xcode 26.6 the app traps roughly two seconds after launch:

_dispatch_assert_queue_fail
swift_task_isCurrentExecutorWithFlagsImpl
closure #1 in SparkleUpdateController.manageBackgroundTask(_:)

Marking it @Sendable makes it properly non-isolated. The hop to the main actor is the Task inside it, which is where the hop belongs — so this is a correctness fix regardless of whether a given toolchain turns that check into a trap or a warning.

The usual workaround, SWIFT_IS_CURRENT_EXECUTOR_LEGACY_MODE_OVERRIDE=legacy, downgrades every executor assertion in the process to a warning, which hides real isolation bugs while testing.

The closure handed to `backgroundQueue.schedule` is non-Sendable, so under
Swift 6 it inherits the enclosing `MainActor` isolation and the compiler
emits an executor check at its entry. It then runs on `backgroundQueue`,
where that check fails -- on Xcode 26.6 the app traps about two seconds
after launch:

    _dispatch_assert_queue_fail
    swift_task_isCurrentExecutorWithFlagsImpl
    closure MythicApp#1 in SparkleUpdateController.manageBackgroundTask(_:)

Marking it `@Sendable` makes it properly non-isolated. The hop to the main
actor is the `Task` inside it, which is where the hop belongs -- so this is
a correctness fix regardless of whether a given toolchain turns the check
into a trap or a warning.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant