Commit ff6c880
authored
Fix crash when pasting images in post composer (#1214)
The app would crash with 'attempt to create backwards NSTextRange from 1 to 0' when pasting images into a post. This was caused by the text system trying to query text ranges while they were being modified.
Fixed by:
- Storing the original selected range before text storage modifications
- Completing all text storage edits before updating the selection
- Deferring selection updates to the next run loop cycle to avoid conflicts with the text system's internal state
- Adding bounds checking to ensure valid cursor positions
This prevents race conditions between our selection updates and the text system's attribute queries.1 parent 40b6fb8 commit ff6c880
1 file changed
+18
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
222 | 223 | | |
223 | 224 | | |
224 | 225 | | |
225 | 226 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | 227 | | |
233 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
234 | 246 | | |
235 | 247 | | |
236 | 248 | | |
| |||
0 commit comments