[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] make sure receiver unregisters when destroyed



commit b322e530da659d714dc28679b158c3ed8fee8d7b
Author: n8fr8 <nathan@xxxxxxxxxxx>
Date:   Mon Oct 16 23:36:14 2017 -0400

    make sure receiver unregisters when destroyed
---
 .../java/org/torproject/android/service/TorService.java  | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/orbotservice/src/main/java/org/torproject/android/service/TorService.java b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
index 597e59e2..36c1b229 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/TorService.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
@@ -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 {



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits