Fix macOS crash on quit due to CADisplayLink teardown race #128

Merged
OragonEfreet merged 1 commit from fix/macos-quit-crash into main 2026-06-01 13:55:00 +02:00
Owner

Calling [CADisplayLink invalidate] directly during video teardown
could crash with "Unlock of an os_unfair_lock not owned by current
thread" if a display link callback was in progress.

Fix by:

  • Clearing the semaphore reference first to stop signaling
  • Dispatching invalidate asynchronously to main queue to ensure
    it runs after any in-progress callback completes
  • Guarding the callback against NULL semaphore
  • Removing manual dispatch_release (ARC manages dispatch objects)
Calling [CADisplayLink invalidate] directly during video teardown could crash with "Unlock of an os_unfair_lock not owned by current thread" if a display link callback was in progress. Fix by: - Clearing the semaphore reference first to stop signaling - Dispatching invalidate asynchronously to main queue to ensure it runs after any in-progress callback completes - Guarding the callback against NULL semaphore - Removing manual dispatch_release (ARC manages dispatch objects)
Fix macOS crash on quit due to CADisplayLink teardown race
All checks were successful
Documentation / build-docs (pull_request) Successful in 9s
QA / cert (pull_request) Successful in 29s
Build and Test / linux-linux-gcc (pull_request) Successful in 17s
Build and Test / linux-windows-mingw (pull_request) Successful in 26s
8923ef1ab7
Calling [CADisplayLink invalidate] directly during video teardown
could crash with "Unlock of an os_unfair_lock not owned by current
thread" if a display link callback was in progress.

Fix by:
- Clearing the semaphore reference first to stop signaling
- Dispatching invalidate asynchronously to main queue to ensure
  it runs after any in-progress callback completes
- Guarding the callback against NULL semaphore
- Removing manual dispatch_release (ARC manages dispatch objects)
OragonEfreet added this to the 1.0 milestone 2026-06-01 09:47:50 +02:00
OragonEfreet deleted branch fix/macos-quit-crash 2026-06-01 13:55:00 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
OragonEfreet/banjo!128
No description provided.