From 7ab7c8abeef5daabc92ae822d95526f7e9677249 Mon Sep 17 00:00:00 2001 From: Kr328 <39107975+Kr328@users.noreply.github.com> Date: Sat, 22 Feb 2020 21:43:28 +0800 Subject: [PATCH] fix receiver leak --- .../src/main/java/com/github/kr328/clash/service/ClashCore.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/service/src/main/java/com/github/kr328/clash/service/ClashCore.kt b/service/src/main/java/com/github/kr328/clash/service/ClashCore.kt index dd3bdec..3f26cc2 100644 --- a/service/src/main/java/com/github/kr328/clash/service/ClashCore.kt +++ b/service/src/main/java/com/github/kr328/clash/service/ClashCore.kt @@ -6,6 +6,7 @@ import android.content.Context import android.content.Intent import android.content.IntentFilter import android.os.PowerManager +import androidx.core.content.contentValuesOf import androidx.core.content.getSystemService import com.github.kr328.clash.core.Clash import com.github.kr328.clash.core.utils.Log @@ -102,6 +103,8 @@ class ClashCore(private val service: Service): CoroutineScope by MainScope() { fun destroy() { cancel() + service.unregisterReceiver(receivers) + reloadChannel.close() notification.destroy()