-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed a bug in on
which caused the signal to be disposed of too early.
#80
Conversation
Thanks for catch! return SignalProducer { observer, compositeDisposable in
// ...
self.startWithSignal { signal, disposable in
compositeDisposable += signal.on(...).observe(observer)
compositeDisposable += disposable |
Disposing the cancel disposable of a produced signal is guaranteed to have In other words, adding the observer disposable to the outer disposable is redundant - there is no point to detach from a known-to-be terminated signal. Moreover, the iteration order is an implementation detail of |
@ikesyo Would you mind to have a look at why Linux PM test fails? It says |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me apart from the linux failures.
|
@andersio I see. Thanks for explanation. LGTM! |
@andersio |
@ikesyo I found that 5.0.0 wrapped the async matchers in something like |
@andersio That is the reason I checked out a specific commit in |
Fixes #77.
The root cause
The outer input observer was detached by the outer interruption, and this causes the started signal to dispose of itself (no observer + unreachable) under the new lifetime semantics.
Moreover, since
CompositeDisposable
disposes its inner disposables in the reversed insertion order, the inner producer is interrupted after the said detachment and self-disposal happened.So in the end, both together caused the injected side effect via
on
capturing no interrupted event.The fix
Generally speaking, the disposable of the outer observer to the produced inner signal should not be added to the outer producer's disposable. The termination is already propagated via
interrupted
.Note
We might need to review the rest of the operators.