make sure receiver unregisters when destroyed

This commit is contained in:
n8fr8 2017-10-16 23:36:14 -04:00
parent 2bd5614210
commit b322e530da
1 changed files with 9 additions and 7 deletions

View File

@ -428,6 +428,14 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
@Override
public void onDestroy() {
try {
unregisterReceiver(mNetworkStateReceiver);
}
catch (IllegalArgumentException iae)
{
//not registered yet
}
stopTor();
/**
@ -476,13 +484,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
clearNotifications();
sendCallbackStatus(STATUS_OFF);
try {
unregisterReceiver(mNetworkStateReceiver);
}
catch (IllegalArgumentException iae)
{
//not registered yet
}
}
private void killAllDaemons() throws Exception {