crash when disposable is already canceled or disposed
zhangyicoding opened this issue · comments
hi,
I used autodispose and found a crash in my project.
Here is a complex situation in my project. I used Observable.merge, when one observable was canceled or disposed and then select other page(RxJava in Fragment, and the fragment in ViewPager), it will show me following log:
FATAL EXCEPTION: main
Process: balabala, PID: balabala
io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | retrofit2.adapter.rxjava2.HttpException: HTTP 403 Forbidden
at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.dispose(ObservableFlatMap.java:313)
at io.reactivex.internal.observers.BasicFuseableObserver.dispose(BasicFuseableObserver.java:152)
at com.uber.autodispose.AutoDisposableHelper.dispose(AutoDisposableHelper.java:44)
at com.uber.autodispose.AutoDisposingObserverImpl$1.onComplete(AutoDisposingObserverImpl.java:55)
I found that line 44 in AutoDisposableHelper did not have any judgement like "if (!current.isDisposed)". I think adding it will be fine.
Thanks.
AutoDisposingObserverImpl.onComplete
already checks if the current is disposed before calling dispose, I'm not sure what adding a redundant check there would offer?
Closing due to lack of activity/information, feel free to revisit if you can provide more information