2nd attempt to fix double unregistering receivers

This commit is contained in:
Mygod
2019-09-19 11:33:50 +08:00
parent add1c96d5c
commit 95ddd5c2d5
3 changed files with 9 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ import be.mygod.vpnhotspot.net.TetheringManager.tetheredIfaces
import be.mygod.vpnhotspot.net.monitor.IpNeighbourMonitor
import be.mygod.vpnhotspot.util.Event0
import be.mygod.vpnhotspot.util.broadcastReceiver
import be.mygod.vpnhotspot.util.ensureReceiverUnregistered
import kotlinx.coroutines.*
import java.util.concurrent.ConcurrentHashMap
@@ -117,7 +118,7 @@ class TetheringService : IpNeighbourMonitoringService(), CoroutineScope {
private fun unregisterReceiver() {
if (receiverRegistered) {
unregisterReceiver(receiver)
ensureReceiverUnregistered(receiver)
IpNeighbourMonitor.unregisterCallback(this)
receiverRegistered = false
}