summaryrefslogtreecommitdiff
path: root/rs/java/android
diff options
context:
space:
mode:
authorYang Ni <yangni@google.com>2016-04-22 19:52:18 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-04-22 19:52:18 +0000
commit888017db7739d8523182d47302eeffbdb066fe1e (patch)
tree79e67ead08d6bf7efd686de4665a1b7255f928f7 /rs/java/android
parent3cd052d38cfa3f113b7d0e842b3e5aafc9667e5f (diff)
parent8ca763803d8960ddc9f6c498c3294e69aac0f7cf (diff)
Merge "Fixed BaseObj finalizer and destroy()" into nyc-dev
am: 8ca7638 * commit '8ca763803d8960ddc9f6c498c3294e69aac0f7cf': Fixed BaseObj finalizer and destroy() Change-Id: Id607034269102c84d673b7148beb0b050121e0bc
Diffstat (limited to 'rs/java/android')
-rw-r--r--rs/java/android/renderscript/Allocation.java3
-rw-r--r--rs/java/android/renderscript/ScriptGroup.java17
2 files changed, 5 insertions, 15 deletions
diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java
index 04ea8e5a663f..c0ea1324602b 100644
--- a/rs/java/android/renderscript/Allocation.java
+++ b/rs/java/android/renderscript/Allocation.java
@@ -392,8 +392,6 @@ public class Allocation extends BaseObj {
protected void finalize() throws Throwable {
RenderScript.registerNativeFree.invoke(RenderScript.sRuntime, mSize);
- // Set mType null to avoid double-destroying it in case its finalizer races ahead
- mType = null;
super.finalize();
}
@@ -2615,7 +2613,6 @@ public class Allocation extends BaseObj {
if (mType != null && mOwningType) {
mType.destroy();
- mType = null;
}
super.destroy();
diff --git a/rs/java/android/renderscript/ScriptGroup.java b/rs/java/android/renderscript/ScriptGroup.java
index 0d10c6d9dc50..e0bdbfcdfed5 100644
--- a/rs/java/android/renderscript/ScriptGroup.java
+++ b/rs/java/android/renderscript/ScriptGroup.java
@@ -1066,19 +1066,12 @@ public final class ScriptGroup extends BaseObj {
*/
public void destroy() {
super.destroy();
- for(Closure c : mClosures) {
- c.destroy();
- }
- }
-
- protected void finalize() throws Throwable {
- // Clear out the list mClosures to avoid double-destroying the closures,
- // in case their finalizers race ahead.
+ // ScriptGroup created using the old Builder class does not
+ // initialize the field mClosures
if (mClosures != null) {
- // ScriptGroup created using the old Builder class does not
- // initialize the field mClosures
- mClosures.clear();
+ for (Closure c : mClosures) {
+ c.destroy();
+ }
}
- super.finalize();
}
}