Fix memory leak due to wikidata edit listener (#2048)

This commit is contained in:
Vivek Maskara 2018-11-30 20:49:42 +05:30 committed by neslihanturan
parent 6391307fad
commit f2d271af37

View file

@ -114,7 +114,6 @@ public class NearbyFragment extends CommonsDaggerSupportFragment
resumeFragment();*/ resumeFragment();*/
bundle = new Bundle(); bundle = new Bundle();
initBottomSheetBehaviour(); initBottomSheetBehaviour();
wikidataEditListener.setAuthenticationStateListener(this);
this.view = view; this.view = view;
return view; return view;
} }
@ -642,6 +641,7 @@ public class NearbyFragment extends CommonsDaggerSupportFragment
@Override @Override
public void onAttach(Context context) { public void onAttach(Context context) {
super.onAttach(context); super.onAttach(context);
wikidataEditListener.setAuthenticationStateListener(this);
} }
@Override @Override
@ -650,6 +650,7 @@ public class NearbyFragment extends CommonsDaggerSupportFragment
if (placesDisposable != null) { if (placesDisposable != null) {
placesDisposable.dispose(); placesDisposable.dispose();
} }
wikidataEditListener.setAuthenticationStateListener(null);
} }
@Override @Override
@ -657,6 +658,7 @@ public class NearbyFragment extends CommonsDaggerSupportFragment
super.onDetach(); super.onDetach();
snackbar = null; snackbar = null;
broadcastReceiver = null; broadcastReceiver = null;
wikidataEditListener.setAuthenticationStateListener(null);
} }
@Override @Override