Skip to content

Commit 85aae44

Browse files
just1103freak4pc
authored andcommitted
fixed memory leak with PassthroughRelay
1 parent ed818f7 commit 85aae44

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Sources/Relays/PassthroughRelay.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,17 @@ private extension PassthroughRelay {
7878
}
7979

8080
func forceFinish() {
81-
sink?.shouldForwardCompletion = true
82-
sink?.receive(completion: .finished)
81+
self.sink?.shouldForwardCompletion = true
82+
self.sink?.receive(completion: .finished)
83+
self.sink = nil
8384
}
8485

8586
func request(_ demand: Subscribers.Demand) {
8687
sink?.demand(demand)
8788
}
8889

8990
func cancel() {
90-
sink = nil
91+
forceFinish()
9192
}
9293
}
9394
}

0 commit comments

Comments
 (0)