Commit 97af3d7
committed
Fix: Make CodeFileDocument's four isolation sites consistent
read(from:ofType:) used a bare MainActor.assumeIsolated, justified by
canConcurrentlyReadDocuments(ofType:) being pinned to false. That
justification was wrong: the pin constrains AppKit's own reads and says
nothing about an in-process caller constructing a document off the main
actor. Commit 1985839 records that exact shape trapping here before and
taking twenty unit tests down with it.
All four nonisolated-override sites now branch on Thread.isMainThread and
assume isolation only on the main-thread side. read and
presentedItemDidChange block with .sync because both must complete before
returning; the LSP notifications and undo registration hop with .async as
they already did.
docs/architecture-decisions.md is corrected too. It previously described
the pin as what made the read path sound, which overstated it.1 parent 3fa21cd commit 97af3d7
2 files changed
Lines changed: 19 additions & 9 deletions
File tree
- CodeEditModules/Sources/CodeEditDocument
- docs
Lines changed: 16 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | 196 | | |
200 | | - | |
201 | | - | |
| 197 | + | |
| 198 | + | |
202 | 199 | | |
203 | 200 | | |
204 | 201 | | |
205 | 202 | | |
206 | | - | |
| 203 | + | |
207 | 204 | | |
208 | 205 | | |
209 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
210 | 220 | | |
211 | 221 | | |
212 | 222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
145 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| |||
0 commit comments