mirror of
https://github.com/M66B/NetGuard.git
synced 2025-01-31 11:52:24 +00:00
Make sure the JNI context is cleared
Reason: onCreate can be called multiple times without onDestroy being called
This commit is contained in:
parent
dafea6ea39
commit
ede610a3da
1 changed files with 7 additions and 1 deletions
|
@ -137,7 +137,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
private int last_blocked = -1;
|
||||
private int last_hosts = -1;
|
||||
|
||||
private long jni_context = 0;
|
||||
private static long jni_context = 0;
|
||||
private Thread tunnelThread = null;
|
||||
private ServiceSinkhole.Builder last_builder = null;
|
||||
private ParcelFileDescriptor vpn = null;
|
||||
|
@ -2350,6 +2350,12 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
if (jni_context != 0) {
|
||||
jni_stop(jni_context);
|
||||
jni_done(jni_context);
|
||||
jni_context = 0;
|
||||
}
|
||||
|
||||
// Native init
|
||||
jni_context = jni_init(Build.VERSION.SDK_INT);
|
||||
boolean pcap = prefs.getBoolean("pcap", false);
|
||||
|
|
Loading…
Reference in a new issue