Skip to content
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

RxScala Bug #1173

Closed
headinthebox opened this issue May 8, 2014 · 2 comments
Closed

RxScala Bug #1173

headinthebox opened this issue May 8, 2014 · 2 comments

Comments

@headinthebox
Copy link
Contributor

def wrap[T](src: Observable[T]): Observable[T] = {
    Observable(subscriber => {
      println("subscribed")
      subscriber.add(src.subscribe(x => subscriber.onNext(x), e => subscriber.onError(e), () => subscriber.onCompleted()))
    })
  }

works but this crashes

def wrap[T](src: Observable[T]): Observable[T] = {
    Observable(subscriber => {
      println("subscribed")
      subscriber.add(src.subscribe(subscriber))
    })
  }
@akarnokd
Copy link
Member

akarnokd commented May 8, 2014

To be sure, this works:

public class ComeCrash {
    public static <T> Observable<T> wrap(Observable<T> source) {
        return Observable.create((Subscriber<? super T> subscriber) -> {
            System.out.println("Subscribed");
            subscriber.add(source.subscribe(subscriber));
        });
    }
    public static void main(String[] args) {
        wrap(Observable.just(1)).subscribe(System.out::println, 
            Throwable::printStackTrace, () -> System.out.println("Done."));
    }
}

zsxwing added a commit to zsxwing/RxJava that referenced this issue May 9, 2014
zsxwing added a commit to zsxwing/RxJava that referenced this issue May 11, 2014
benjchristensen added a commit that referenced this issue May 19, 2014
@benjchristensen
Copy link
Member

Closing as #1178 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants