Skip to content

Commit f860308

Browse files
committed
fixed memory leak with PassthroughRelay
1 parent d7b896f commit f860308

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎Sources/Relays/PassthroughRelay.swift‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,15 @@ private extension PassthroughRelay {
7474
func forceFinish() {
7575
self.sink?.shouldForwardCompletion = true
7676
self.sink?.receive(completion: .finished)
77+
self.sink = nil
7778
}
7879

7980
func request(_ demand: Subscribers.Demand) {
8081
sink?.demand(demand)
8182
}
8283

8384
func cancel() {
84-
sink = nil
85+
forceFinish()
8586
}
8687
}
8788
}

0 commit comments

Comments
 (0)