summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/OpenVpnService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVpnService.java')
-rw-r--r--src/de/blinkt/openvpn/OpenVpnService.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java
index 66ab9e30..cecae9d1 100644
--- a/src/de/blinkt/openvpn/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/OpenVpnService.java
@@ -114,15 +114,16 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
private void endVpnService() {
mProcessThread=null;
OpenVPN.logBuilderConfig(null);
- OpenVPN.removeStateListener(this);
OpenVPN.removeByteCountListener(this);
unregisterNetworkStateReceiver();
ProfileManager.setConntectedVpnProfileDisconnected(this);
if(!mStarting) {
stopForeground(!mNotificationalwaysVisible);
- if( !mNotificationalwaysVisible)
+ if( !mNotificationalwaysVisible) {
stopSelf();
+ OpenVPN.removeStateListener(this);
+ }
}
}
@@ -351,6 +352,8 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
if (mNetworkStateReceiver!= null) {
this.unregisterReceiver(mNetworkStateReceiver);
}
+ // Just in case unregister for state
+ OpenVPN.removeStateListener(this);
}