Skip to content

Conversation

@nekohasekai
Copy link
Contributor

Summary

  • Replace asyncAndWait with sync to fix crash on macOS 13

Problem

DispatchQueue.asyncAndWait(execute:) is only available on macOS 14+. Using #available check doesn't help because the symbol is still hard-linked in the binary, causing dyld to crash at launch on older systems:

Symbol not found: _$sSo17OS_dispatch_queueC8DispatchE12asyncAndWait7executexxyKXE_tKlF
Expected in: /usr/lib/swift/libswiftDispatch.dylib

Solution

Use DispatchQueue.main.sync(execute:) instead, which has equivalent behavior and is available on all macOS versions.

Remove asyncAndWait which is unavailable on macOS < 14. Using sync instead, which has equivalent behavior.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a crash on macOS 13 by replacing an API that's only available on macOS 14+ with a backward-compatible equivalent. The issue was that asyncAndWait caused dyld to crash at launch on macOS 13 due to hard-linking of unavailable symbols, even when guarded with availability checks.

Key Changes:

  • Replace DispatchQueue.main.asyncAndWait(execute:) with DispatchQueue.main.sync(execute:) which has identical behavior and is available on macOS 13+

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@0xWDG 0xWDG marked this pull request as ready for review December 31, 2025 09:52
@0xWDG 0xWDG merged commit 1fa4d3c into CodeEditApp:main Dec 31, 2025
8 checks passed
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.

2 participants