From c6e8d8484bcf61c7d7ff2b9957069e7512a74db8 Mon Sep 17 00:00:00 2001 From: Haruki Tosa <44115752+harukitosa@users.noreply.github.com> Date: Mon, 2 Mar 2026 14:38:23 +0900 Subject: [PATCH] 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. --- Sources/WindowDragHandleView.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sources/WindowDragHandleView.swift b/Sources/WindowDragHandleView.swift index d8d23f7c..15f406e9 100644 --- a/Sources/WindowDragHandleView.swift +++ b/Sources/WindowDragHandleView.swift @@ -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,