Skip to content

Fix crash(es) caused by disposed Rx observables. #2668

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

Closed
wants to merge 1 commit into from

Conversation

dbrant
Copy link
Collaborator

@dbrant dbrant commented Mar 19, 2019

After Rx Observables are disposed, they can still produce errors, and if they are detached from an Observer when an error happens, the error goes to a "global" error handler defined in Rx. By default, this error handler does nothing, and allows the error to be unhandled, thereby causing a crash.

(I'm guessing you've seen these kinds of crashes -- it might happen right after you back out of an Activity, or anytime you dispose an observable that is still performing a network call.)

This fixes these crashes by providing an "empty" global Rx error handler. This means that any time you subscribe to an Observable, you should provide an onError handler (assuming you want to handle errors from it). And for Observables where you don't care about errors, they will simply fall through without crashing.

@dbrant
Copy link
Collaborator Author

dbrant commented Mar 19, 2019

Consolidated into #2669

@dbrant dbrant closed this Mar 19, 2019
@domdomegg domdomegg removed their request for review March 19, 2019 21:03
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

Successfully merging this pull request may close these issues.

1 participant