Skip to content

Commit e2814fe

Browse files
Fix Ventura Crash (#2106)
### Description Fixes a crash on Ventura where we're referencing a symbol that apparently doesn't exist in libdispatch. Just replaces `.asyncAndWait` with a call to `.sync` since we're not on the main thread already. ### Related Issues * closes #2091 ### Checklist - [x] I read and understood the [contributing guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md) as well as the [code of conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md) - [x] The issues this PR addresses are related to each other - [x] My changes generate no new warnings - [x] My code builds and runs on my machine - [x] My changes are all related to the related issue above - [x] I documented my code ### Screenshots
1 parent af6e007 commit e2814fe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

CodeEdit/Features/Documents/CodeFileDocument/CodeFileDocument.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,11 @@ final class CodeFileDocument: NSDocument, ObservableObject {
259259
// This blocks the presented item thread intentionally. If we don't wait, we'll receive more updates
260260
// that the file has changed and we'll end up dispatching multiple reads.
261261
// The presented item thread expects this operation to by synchronous anyways.
262-
DispatchQueue.main.asyncAndWait {
262+
263+
// https://github.com/CodeEditApp/CodeEdit/issues/2091
264+
// We can't use `.asyncAndWait` on Ventura as it seems the symbol is missing on that platform.
265+
// Could be just for x86 machines.
266+
DispatchQueue.main.sync {
263267
try? self.read(from: fileURL, ofType: fileType)
264268
}
265269
}

0 commit comments

Comments
 (0)