Fix exclusive-access crash in WindowDragHandleView hitTest (#736)
Add early return for non-leftMouseDown events in DraggableView.hitTest to prevent re-entering SwiftUI view state during mouseMoved layout passes, which caused fatal exclusive-access violations.
This commit is contained in:
parent
33242f8780
commit
c6e8d8484b
1 changed files with 7 additions and 0 deletions
|
|
@ -359,6 +359,13 @@ struct WindowDragHandleView: NSViewRepresentable {
|
|||
|
||||
override func hitTest(_ point: NSPoint) -> NSView? {
|
||||
let currentEvent = NSApp.currentEvent
|
||||
// Fast bail-out: only claim hits for left-mouse-down events.
|
||||
// For mouseMoved / mouseEntered / etc., return nil immediately
|
||||
// to avoid re-entering SwiftUI view state during layout passes,
|
||||
// which causes exclusive-access crashes.
|
||||
guard currentEvent?.type == .leftMouseDown else {
|
||||
return nil
|
||||
}
|
||||
let shouldCapture = windowDragHandleShouldCaptureHit(
|
||||
point,
|
||||
in: self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue