From fd691c468a6508591fbdebe45ac1f5eae3666268 Mon Sep 17 00:00:00 2001 From: John Bogart <69876287+Johnjackbogart@users.noreply.github.com> Date: Sun, 9 Aug 2026 10:19:45 -0400 Subject: [PATCH] Fix hit_test function superclass lookup Refactor hit_test function to use statically-known NSView class for superclass lookup avoiding infinite recursion issues. --- src/platform/macos/view.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/platform/macos/view.rs b/src/platform/macos/view.rs index bc9f8043..a7f2be76 100644 --- a/src/platform/macos/view.rs +++ b/src/platform/macos/view.rs @@ -380,6 +380,14 @@ impl ViewImpl for BaseviewView { /// collapse, so the override pass-through is equivalent to the /// default implementation. fn hit_test(this: ViewRef<'_, Self>, point: NSPoint) -> Option<&NSView> { + // Use the statically-known NSView class instead of a live `this.view.class()` lookup. + // baseview itself registers this class's superclass as NSView::class() at creation time + // (see src/wrappers/appkit/view/implementation.rs), so this isn't a new assumption — it's + // the same value, fetched safely instead of re-derived at hitTest call time, where the + // live lookup was returning something else on macOS 26.6 and causing infinite recursion. + // prior: + // let superclass = this.view.class().superclass().unwrap(); + let superclass = NSView::class(); // SAFETY: Our superclass is NSView