-
Notifications
You must be signed in to change notification settings - Fork 770
4.x: Inline StableCompositeDisposable.Create into the Sinks #578
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
Changes from all commits
b62c7ba
f5fd5fb
e252198
0e2b2aa
f9fa64d
f586981
477047a
9500f9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ public _(SynchronizationContext context, IObserver<TSource> observer) | |
_context = context; | ||
} | ||
|
||
public void Run(IObservable<TSource> source) | ||
public override void Run(IObservable<TSource> source) | ||
{ | ||
// | ||
// The interactions with OperationStarted/OperationCompleted below allow | ||
|
@@ -83,10 +83,16 @@ public void Run(IObservable<TSource> source) | |
// | ||
_context.OperationStarted(); | ||
|
||
var d = source.SubscribeSafe(this); | ||
var c = Disposable.Create(_context.OperationCompleted); | ||
SetUpstream(source.SubscribeSafe(this)); | ||
} | ||
|
||
SetUpstream(StableCompositeDisposable.Create(d, c)); | ||
protected override void Dispose(bool disposing) | ||
{ | ||
if (disposing) | ||
{ | ||
_context.OperationCompleted(); | ||
} | ||
base.Dispose(disposing); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assuming the order is not significant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not. |
||
} | ||
|
||
public override void OnNext(TSource value) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,7 @@ public _(Func<TException, IObservable<TSource>> handler, IObserver<TSource> obse | |
|
||
private SerialDisposable _subscription; | ||
|
||
public void Run(IObservable<TSource> source) | ||
public override void Run(IObservable<TSource> source) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe indeed a use case for applying serial-semantics to the upstream-disposable in Sink? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VS was full of complaining about these missing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Careful, it's not complaining about missing overrides, it's notifying you that the new Run hides base.Run, which might or might not be what you want. Don't just write There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was still ambiguous; the base.Run is designed to be overridden but perhaps all void Runs could be also |
||
{ | ||
_subscription = new SerialDisposable(); | ||
|
||
|
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.
That's a bug even in the original code?
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.
Same bug as with #560.