diff --git a/Sources/OpenAPIURLSession/URLSessionBidirectionalStreaming/HTTPBodyOutputStreamBridge.swift b/Sources/OpenAPIURLSession/URLSessionBidirectionalStreaming/HTTPBodyOutputStreamBridge.swift index 3b89d62..f3d040a 100644 --- a/Sources/OpenAPIURLSession/URLSessionBidirectionalStreaming/HTTPBodyOutputStreamBridge.swift +++ b/Sources/OpenAPIURLSession/URLSessionBidirectionalStreaming/HTTPBodyOutputStreamBridge.swift @@ -36,7 +36,10 @@ final class HTTPBodyOutputStreamBridge: NSObject, StreamDelegate { self.outputStream.open() } - deinit { debug("Output stream delegate deinit") } + deinit { + debug("Output stream delegate deinit") + self.outputStream.delegate = nil + } func performAction(_ action: State.Action) { debug("Output stream delegate performing action from state machine: \(action)")