diff options
author | Fup Duck <fupduck@sacknagel.com> | 2018-01-30 14:35:25 +0100 |
---|---|---|
committer | Fup Duck <fupduck@sacknagel.com> | 2018-01-30 14:35:25 +0100 |
commit | 6be60844db062575055752b554dbf14941e8e185 (patch) | |
tree | f58c0703193170308d838f8af465aeee9e79b61f /app/src/main | |
parent | c0848bac7ac44f4b09f9e5d66ab71f079cb0f514 (diff) |
8828 - fix EipFragment leak
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/EipFragment.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 414b1f2a..4027bc14 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -130,13 +130,13 @@ public class EipFragment extends Fragment implements Observer { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); eipStatus = EipStatus.getInstance(); - eipStatus.addObserver(this); eipReceiver = new EIPReceiver(new Handler()); preferences = getActivity().getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + eipStatus.addObserver(this); View view = inflater.inflate(R.layout.eip_service_fragment, container, false); ButterKnife.inject(this, view); @@ -163,6 +163,12 @@ public class EipFragment extends Fragment implements Observer { } @Override + public void onDestroyView() { + super.onDestroyView(); + eipStatus.deleteObserver(this); + } + + @Override public void onSaveInstanceState(Bundle outState) { outState.putBoolean(IS_CONNECTED, eipStatus.isConnected()); super.onSaveInstanceState(outState); |