diff options
author | Yang Ni <yangni@google.com> | 2016-04-18 14:27:02 -0700 |
---|---|---|
committer | Yang Ni <yangni@google.com> | 2016-04-19 09:46:47 -0700 |
commit | e04e5d7cc0a8a1b2792448c885aed9f360e34b14 (patch) | |
tree | d23df0e7a0e1c0a8ea57072e0b575380aa53c298 /rs/java/android/renderscript/ScriptGroup.java | |
parent | e05bdb15e519fb0d7575d33cb08ff9e17b117568 (diff) |
Fixed ScriptGroup finalizer for old API
Bug: 28242626
ScriptGroup finalizer clears out the list of closures, which is
uninitialized for the old API.
Need to check null first, before accessing the list.
Change-Id: Ibf914e17a0878c8c561f823c5f6f6f6619594de1
(cherry picked from commit 07837d6dab331b1693aa3689223b4012012a7fad)
Diffstat (limited to 'rs/java/android/renderscript/ScriptGroup.java')
-rw-r--r-- | rs/java/android/renderscript/ScriptGroup.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/rs/java/android/renderscript/ScriptGroup.java b/rs/java/android/renderscript/ScriptGroup.java index 35ae8b406e45..0d10c6d9dc50 100644 --- a/rs/java/android/renderscript/ScriptGroup.java +++ b/rs/java/android/renderscript/ScriptGroup.java @@ -1074,7 +1074,11 @@ public final class ScriptGroup extends BaseObj { protected void finalize() throws Throwable { // Clear out the list mClosures to avoid double-destroying the closures, // in case their finalizers race ahead. - mClosures.clear(); + if (mClosures != null) { + // ScriptGroup created using the old Builder class does not + // initialize the field mClosures + mClosures.clear(); + } super.finalize(); } } |