mirror of
https://github.com/M66B/NetGuard.git
synced 2025-01-03 13:54:09 +00:00
Synchronize JNI done
This commit is contained in:
parent
bbd12a7386
commit
4c8d1d89d1
1 changed files with 9 additions and 3 deletions
|
@ -137,6 +137,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
private int last_blocked = -1;
|
private int last_blocked = -1;
|
||||||
private int last_hosts = -1;
|
private int last_hosts = -1;
|
||||||
|
|
||||||
|
private static Object jni_lock = new Object();
|
||||||
private static long jni_context = 0;
|
private static long jni_context = 0;
|
||||||
private Thread tunnelThread = null;
|
private Thread tunnelThread = null;
|
||||||
private ServiceSinkhole.Builder last_builder = null;
|
private ServiceSinkhole.Builder last_builder = null;
|
||||||
|
@ -2352,8 +2353,10 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
|
|
||||||
if (jni_context != 0) {
|
if (jni_context != 0) {
|
||||||
jni_stop(jni_context);
|
jni_stop(jni_context);
|
||||||
jni_done(jni_context);
|
synchronized (jni_lock) {
|
||||||
jni_context = 0;
|
jni_done(jni_context);
|
||||||
|
jni_context = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Native init
|
// Native init
|
||||||
|
@ -2718,7 +2721,10 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||||
}
|
}
|
||||||
|
|
||||||
jni_done(jni_context);
|
synchronized (jni_lock) {
|
||||||
|
jni_done(jni_context);
|
||||||
|
jni_context = 0;
|
||||||
|
}
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
prefs.unregisterOnSharedPreferenceChangeListener(this);
|
prefs.unregisterOnSharedPreferenceChangeListener(this);
|
||||||
|
|
Loading…
Reference in a new issue