Fix exclusive-access crash in WindowDragHandleView hitTest
Merged
HA
9mo ago+7+7+0123456789-0-0-0123456789
Summary
- Fix a crash caused by Swift exclusive-access violation in
WindowDragHandleView.DraggableView.hitTest - During
mouseMovedevents, SwiftUI's internal layout pass callshitTest, which re-enters SwiftUI view state viawindowDragHandleShouldCaptureHit, triggering a fatal access conflict - Added early return for non-
leftMouseDownevents before calling the heavyweight function, avoiding SwiftUI re-entry entirely
Fixes #723
Root Cause
Simultaneous accesses to 0x6000029cc2a0, but modification requires exclusive access.
Fatal access conflict detected.
The crash occurs when:
- A
mouseMovedevent triggers SwiftUI's internal state modification - SwiftUI calls
hitTestonDraggableViewduring that modification windowDragHandleShouldCaptureHitaccesses SwiftUI-managed view properties before reaching the existingleftMouseDownguard, causing re-entry
Test plan
- Downloaded v0.61.0 release and reproduced the crash by moving the mouse over the titlebar area
- Built debug app with the fix and confirmed the crash no longer reproduces with the same steps
Summary by CodeRabbit
- Bug Fixes
- Improved drag event handling to prevent interface issues that could occur during certain interactions. The application now properly restricts event processing, preventing unwanted behavior and stability issues during layout updates.