Merge "Clear more native pointers in finalizers"

This commit is contained in:
Hans Boehm
2016-05-10 23:41:30 +00:00
committed by Gerrit Code Review
6 changed files with 7 additions and 1 deletions

View File

@@ -163,6 +163,7 @@ public class Camera {
protected void finalize() throws Throwable {
try {
nativeDestructor();
native_instance = 0;
} finally {
super.finalize();
}

View File

@@ -40,6 +40,7 @@ public class ColorFilter {
super.finalize();
} finally {
destroyFilter(native_instance);
native_instance = 0;
}
}

View File

@@ -33,6 +33,7 @@ public class DrawFilter {
protected void finalize() throws Throwable {
try {
nativeDestructor(mNativeInt);
mNativeInt = 0;
} finally {
super.finalize();
}

View File

@@ -21,7 +21,7 @@ import java.io.InputStream;
import java.io.FileInputStream;
public class Movie {
private final long mNativeMovie;
private long mNativeMovie;
private Movie(long nativeMovie) {
if (nativeMovie == 0) {
@@ -82,6 +82,7 @@ public class Movie {
protected void finalize() throws Throwable {
try {
nativeDestructor(mNativeMovie);
mNativeMovie = 0;
} finally {
super.finalize();
}

View File

@@ -26,6 +26,7 @@ public class Rasterizer {
protected void finalize() throws Throwable {
finalizer(native_instance);
native_instance = 0;
}
private static native void finalizer(long native_instance);

View File

@@ -33,6 +33,7 @@ public class Xfermode {
protected void finalize() throws Throwable {
try {
finalizer(native_instance);
native_instance = 0;
} finally {
super.finalize();
}