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

Single's Disposable is not disposing. #5276

Closed
qwert2603 opened this issue Apr 10, 2017 · 2 comments
Closed

Single's Disposable is not disposing. #5276

qwert2603 opened this issue Apr 10, 2017 · 2 comments

Comments

@qwert2603
Copy link
Contributor

I noticed that Disposable returned from Single::subscribe(final BiConsumer<? super T, ? super Throwable> onCallback) returns false from Disposable::isDisposed even after onCallback was called. Version of RxJava is 2.0.8. Code sample:

import io.reactivex.Single
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers

fun main(args: Array<String>) {

    var disposable: Disposable? = null
    disposable = Single.just(34)
            .subscribeOn(Schedulers.computation())
            .observeOn(Schedulers.io())
            .subscribe { item, throwable ->
                println("1 ${disposable?.isDisposed}")
            }

    println("2 ${disposable?.isDisposed}")
    Thread.sleep(1000)
    println("3 ${disposable?.isDisposed}")

}

Output is:

2 false
1 false
3 false
@akarnokd
Copy link
Member

Thanks for reporting. This is indeed an inconsistency with other methods. See #5277 for the fix.

@akarnokd
Copy link
Member

Closing via #5277.

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

No branches or pull requests

2 participants