Avoiding OperatorObserveOn from calling subscriber.onNext(..) after unsu...

...bscribe().

The OperatorObserveOn operator uses a scheduler to cancel subscriptions as well
as to deliver the objects passing through it's onNext(..) in the right context.

Calling unsubscribe will schedule the actual unsubscription while not making sure
that the child subscriber will no longer receive calls to onNext(..) after
unsubscribe() returns.

This fix makes sure that after unsubscribe() returns no more onNext(..) calls will be
made on the child subscribers.

Signed-off-by: David Marques <dpsmarques@gmail.com>
No, we use !isError() && !isCompleted(), but in this case, you'd only let an onError event through regardless of the scheduledUnsubscribe status. So:

if (on.isError(v)) {
  observer.onError(on.getError(v));
} else
if (!scheduledUnsubscribe.isUnsubscribed()) {
  on.accept(observer, v);
}