Merge "Clear more native pointers in finalizers"

am: a5ca0ca886

* commit 'a5ca0ca8860ac99eaa2ad7c959fd4e04d331153e':
  Clear more native pointers in finalizers

Change-Id: I5577b85c83da164c0cb4add151bab18cf1555c9a
This commit is contained in:
Hans Boehm
2016-05-10 23:45:34 +00:00
committed by android-build-merger
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();
}