From 7121b0eb434148b82f46b8fe7a58bcba9a424d17 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Thu, 18 Jun 2026 21:20:37 +0000 Subject: [PATCH] fix(apple): disarm CHHapticEngine handlers with no-ops, not nil stoppedHandler/resetHandler are non-optional closures on the CI SDK ((StoppedReason)->() and ()->()), so assigning nil fails to compile (apple.yml). Assign no-op closures to disarm them before engine.stop() -- same re-entrancy guard intent, type-correct. Co-Authored-By: Claude Opus 4.8 (1M context) --- clients/apple/Sources/PunktfunkKit/GamepadFeedback.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clients/apple/Sources/PunktfunkKit/GamepadFeedback.swift b/clients/apple/Sources/PunktfunkKit/GamepadFeedback.swift index 464c082..07ef4af 100644 --- a/clients/apple/Sources/PunktfunkKit/GamepadFeedback.swift +++ b/clients/apple/Sources/PunktfunkKit/GamepadFeedback.swift @@ -186,9 +186,10 @@ private final class RumbleRenderer: @unchecked Sendable { private func teardown() { for m in [low, high].compactMap({ $0 }) { - // Drop the handlers before stopping so stop() can't re-enter teardown via stoppedHandler. - m.engine.stoppedHandler = nil - m.engine.resetHandler = nil + // Disarm the handlers before stopping so stop() can't re-enter teardown via them. + // (Both properties are non-optional closures on this SDK, so assign no-ops, not nil.) + m.engine.stoppedHandler = { _ in } + m.engine.resetHandler = {} try? m.player.stop(atTime: CHHapticTimeImmediate) m.engine.stop() }