summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2018-02-06 10:24:28 -0800
committercyberta <cyberta@riseup.net>2018-02-06 10:24:28 -0800
commite33292227eeac35194f9217edd5a243c688cb560 (patch)
tree5c19ebc8a7049b913b2f2cbe698357f661a9e923 /app/src/main
parenta719b004a5159461b320cfbe808837708149f266 (diff)
parentb4b18f1d52956cf067f87d75d8f3f06c9be48afe (diff)
Merge branch '8828_memory_leap_eip' into '0.9.8'
8828 - fix EipFragment leak See merge request leap/bitmask_android!32
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EipFragment.java8
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);