Skip to content

Commit 57a902a

Browse files
committed
Fix append operator disposing race condition
1 parent dfb63f8 commit 57a902a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/SignalProtocol+Combining.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,18 @@ extension SignalProtocol {
143143
/// Check out interactive example at [https://rxmarbles.com/#concat](https://rxmarbles.com/#concat)
144144
public func append<O: SignalProtocol>(_ other: O) -> Signal<Element, Error> where O.Element == Element, O.Error == Error {
145145
return Signal { observer in
146-
let serialDisposable = SerialDisposable(otherDisposable: nil)
147-
serialDisposable.otherDisposable = self.observe { event in
146+
let disposable = CompositeDisposable()
147+
disposable += self.observe { event in
148148
switch event {
149149
case .next(let element):
150150
observer.receive(element)
151151
case .failed(let error):
152152
observer.receive(completion: .failure(error))
153153
case .completed:
154-
serialDisposable.otherDisposable = other.observe(with: observer.on)
154+
disposable += other.observe(with: observer.on)
155155
}
156156
}
157-
return serialDisposable
157+
return disposable
158158
}
159159
}
160160

0 commit comments

Comments
 (0)