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

Fix crash(es) caused by failing to dispose Rx observables #2669

Merged
merged 24 commits into from
Mar 19, 2019
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3657487
Add missing global error handler.
dbrant Mar 19, 2019
4d0db8d
Remove unnecessary disposable container.
dbrant Mar 19, 2019
d6e630f
Add missing disposal logic.
dbrant Mar 19, 2019
df37a07
Add convenience CompoundDisposable to BaseActivity.
dbrant Mar 19, 2019
78c85c4
Add missing disposable logic.
dbrant Mar 19, 2019
b1ad7a2
Add missing dispose logic.
dbrant Mar 19, 2019
9033acc
Add missing dispose logic.
dbrant Mar 19, 2019
e1fbb02
Fix additional missing Rx disposal logic.
dbrant Mar 19, 2019
d4f3fa7
Fix even more Rx dispose logic.
dbrant Mar 19, 2019
d6ab30f
Simplify dispose logic.
dbrant Mar 19, 2019
d1c83a6
Remove redundant CompositeDisposable.
dbrant Mar 19, 2019
c2a20ce
Properly contain and dispose of additional observables.
dbrant Mar 19, 2019
5ab731d
Remove unnecessary disposable container.
dbrant Mar 19, 2019
69b4326
Add missing disposal logic.
dbrant Mar 19, 2019
0e261d8
Add convenience CompoundDisposable to BaseActivity.
dbrant Mar 19, 2019
f15972c
Add missing disposable logic.
dbrant Mar 19, 2019
078234b
Add missing dispose logic.
dbrant Mar 19, 2019
f812f37
Add missing dispose logic.
dbrant Mar 19, 2019
90a0548
Fix additional missing Rx disposal logic.
dbrant Mar 19, 2019
94bf47b
Fix even more Rx dispose logic.
dbrant Mar 19, 2019
51e119e
Simplify dispose logic.
dbrant Mar 19, 2019
3c8dc09
Remove redundant CompositeDisposable.
dbrant Mar 19, 2019
cfeed69
Merge branch 'RxFixes2' of github.com:dbrant/apps-android-commons int…
dbrant Mar 19, 2019
14a2975
Merge branch 'RxFixes3' into RxFixes2
dbrant Mar 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unnecessary disposable container.
  • Loading branch information
dbrant committed Mar 19, 2019
commit 4d0db8db12cfa7887591d58bc63840eb2b863508
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import timber.log.Timber;

Expand Down Expand Up @@ -101,7 +100,6 @@ public class ContributionsFragment
@BindView(R.id.card_view_nearby) public NearbyNotificationCardView nearbyNotificationCardView;
@BindView(R.id.campaigns_view) CampaignView campaignView;

private Disposable placesDisposable;
private LatLng curLatLng;

private boolean firstLocationUpdate = true;
Expand Down Expand Up @@ -603,15 +601,15 @@ private void displayYouWontSeeNearbyMessage() {
private void updateClosestNearbyCardViewInfo() {
curLatLng = locationManager.getLastLocation();

placesDisposable = Observable.fromCallable(() -> nearbyController
compositeDisposable.add(Observable.fromCallable(() -> nearbyController
.loadAttractionsFromLocation(curLatLng, curLatLng, true, false)) // thanks to boolean, it will only return closest result
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::updateNearbyNotification,
throwable -> {
Timber.d(throwable);
updateNearbyNotification(null);
});
}));
}

private void updateNearbyNotification(@Nullable NearbyController.NearbyPlacesInfo nearbyPlacesInfo) {
Expand Down Expand Up @@ -648,10 +646,6 @@ public void onDestroy() {
isUploadServiceConnected = false;
}
}

if (placesDisposable != null) {
placesDisposable.dispose();
}
}

@Override
Expand Down