Commit d01295b3 authored by Max Lv's avatar Max Lv

fix a crash when timeout in Exec

parent 88ecb02e
......@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.shadowsocks"
android:installLocation="auto"
android:versionCode="7"
android:versionName="1.1.3">
android:versionCode="8"
android:versionName="1.1.4">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
......
......@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.shadowsocks</groupId>
<artifactId>shadowsocks</artifactId>
<version>1.1.3</version>
<version>1.1.4</version>
<packaging>apk</packaging>
<name>Shadowsocks</name>
......
......@@ -271,6 +271,21 @@ public class Utils {
private final boolean asroot;
public int exitcode = -1;
private int[] pid = new int[1];
private FileDescriptor pipe;
@Override
public void destroy() {
if (pid[0] != -1) {
Exec.hangupProcessGroup(pid[0]);
pid[0] = -1;
}
if (pipe != null) {
Exec.close(pipe);
pipe = null;
}
}
/**
* Creates a new script runner.
*
......@@ -344,8 +359,6 @@ public class Utils {
@Override
public void run() {
FileDescriptor pipe = null;
int pid[] = new int[1];
pid[0] = -1;
try {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment