Skip to content

Fix SIGABRT crash on macOS 26: dispatch toggleMenuIconDisabled to main queue#323

Open
agentheath wants to merge 1 commit into
TermiT:masterfrom
agentheath:fix/macos26-nsimageview-crash
Open

Fix SIGABRT crash on macOS 26: dispatch toggleMenuIconDisabled to main queue#323
agentheath wants to merge 1 commit into
TermiT:masterfrom
agentheath:fix/macos26-nsimageview-crash

Conversation

@agentheath
Copy link
Copy Markdown

What

Wraps the background-thread call to toggleMenuIconDisabled in dispatch_async(dispatch_get_main_queue(), ...) in pollPB:.

Why

pollPB: dispatches pasteboard reads to a background GCD queue to avoid blocking the main thread while waiting for large clipboard transfers (this is intentional — see the comment in the code). Inside that block, toggleMenuIconDisabled was being called directly from the background thread to restore the menu icon after a Remote Desktop Connection transfer completes.

toggleMenuIconDisabled modifies NSStatusItem via setImage: and setTitle:, which internally update an NSImageView. macOS 26 now enforces stricter main-thread assertions for NSImageView operations (via _NSAsynchronousPreparation), causing an abort trap / SIGABRT.

Fix

// BEFORE
if (largeCopyRisk)
    [self toggleMenuIconDisabled];

// AFTER
if (largeCopyRisk) {
    dispatch_async(dispatch_get_main_queue(), ^{
        [self toggleMenuIconDisabled];
    });
}

The first call to toggleMenuIconDisabled at line 883 (before the dispatch block) is already on the main thread and does not need wrapping.

Scope

Only AppController.m is changed. BezelWindow.m was audited — setSourceIcon: and related image methods are only reachable from main-thread code paths and do not need changes.

…n queue

The pollPB: method dispatches pasteboard reads to a background GCD queue.
Inside that block, toggleMenuIconDisabled updates NSStatusItem images via
setImage:/setTitle:. macOS 26 enforces stricter main-thread assertions for
NSImageView operations in _NSAsynchronousPreparation, causing an abort trap.

Wrap the background-thread call to toggleMenuIconDisabled in
dispatch_async(dispatch_get_main_queue(), ...) so the UI update runs on the
main thread. The first call (before the dispatch block) is already on the
main thread and does not need wrapping.
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