Merge "Clear more native pointers in finalizers" am: a5ca0ca886
am: 8521a8ff86
* commit '8521a8ff860e89ca60d530db60f58878847cf52a':
Clear more native pointers in finalizers
Change-Id: Icca385cd603ad15ab02f2033f8652e3a8d2f6c3d
diff --git a/graphics/java/android/graphics/Camera.java b/graphics/java/android/graphics/Camera.java
index 57e0f27..60588d0 100644
--- a/graphics/java/android/graphics/Camera.java
+++ b/graphics/java/android/graphics/Camera.java
@@ -163,6 +163,7 @@
protected void finalize() throws Throwable {
try {
nativeDestructor();
+ native_instance = 0;
} finally {
super.finalize();
}
diff --git a/graphics/java/android/graphics/ColorFilter.java b/graphics/java/android/graphics/ColorFilter.java
index 4838aa0..ac62bf4 100644
--- a/graphics/java/android/graphics/ColorFilter.java
+++ b/graphics/java/android/graphics/ColorFilter.java
@@ -40,6 +40,7 @@
super.finalize();
} finally {
destroyFilter(native_instance);
+ native_instance = 0;
}
}
diff --git a/graphics/java/android/graphics/DrawFilter.java b/graphics/java/android/graphics/DrawFilter.java
index aaefce9..c7fdcb2 100644
--- a/graphics/java/android/graphics/DrawFilter.java
+++ b/graphics/java/android/graphics/DrawFilter.java
@@ -33,6 +33,7 @@
protected void finalize() throws Throwable {
try {
nativeDestructor(mNativeInt);
+ mNativeInt = 0;
} finally {
super.finalize();
}
diff --git a/graphics/java/android/graphics/Movie.java b/graphics/java/android/graphics/Movie.java
index ecb4255..c8f86c6 100644
--- a/graphics/java/android/graphics/Movie.java
+++ b/graphics/java/android/graphics/Movie.java
@@ -21,7 +21,7 @@
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 @@
protected void finalize() throws Throwable {
try {
nativeDestructor(mNativeMovie);
+ mNativeMovie = 0;
} finally {
super.finalize();
}
diff --git a/graphics/java/android/graphics/Rasterizer.java b/graphics/java/android/graphics/Rasterizer.java
index c351d94..f6a38fe 100644
--- a/graphics/java/android/graphics/Rasterizer.java
+++ b/graphics/java/android/graphics/Rasterizer.java
@@ -26,6 +26,7 @@
protected void finalize() throws Throwable {
finalizer(native_instance);
+ native_instance = 0;
}
private static native void finalizer(long native_instance);
diff --git a/graphics/java/android/graphics/Xfermode.java b/graphics/java/android/graphics/Xfermode.java
index 883350d..c049e41 100644
--- a/graphics/java/android/graphics/Xfermode.java
+++ b/graphics/java/android/graphics/Xfermode.java
@@ -33,6 +33,7 @@
protected void finalize() throws Throwable {
try {
finalizer(native_instance);
+ native_instance = 0;
} finally {
super.finalize();
}