mirror of
https://github.com/M66B/NetGuard.git
synced 2024-12-27 02:09:41 +00:00
Fixed crash on stop
This commit is contained in:
parent
e02820260c
commit
4c26a0b84c
1 changed files with 15 additions and 13 deletions
|
@ -1442,23 +1442,25 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
private void stopNative(ParcelFileDescriptor vpn, boolean clear) {
|
||||
Log.i(TAG, "Stop native clear=" + clear);
|
||||
|
||||
if (tunnelThread != null) {
|
||||
Log.i(TAG, "Stopping tunnel thread");
|
||||
synchronized (getApplicationContext()) {
|
||||
if (tunnelThread != null) {
|
||||
Log.i(TAG, "Stopping tunnel thread");
|
||||
|
||||
jni_stop();
|
||||
jni_stop();
|
||||
|
||||
while (true)
|
||||
try {
|
||||
tunnelThread.join();
|
||||
break;
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
tunnelThread = null;
|
||||
while (true)
|
||||
try {
|
||||
tunnelThread.join();
|
||||
break;
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
tunnelThread = null;
|
||||
|
||||
if (clear)
|
||||
jni_clear();
|
||||
if (clear)
|
||||
jni_clear();
|
||||
|
||||
Log.i(TAG, "Stopped tunnel thread");
|
||||
Log.i(TAG, "Stopped tunnel thread");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue