summaryrefslogtreecommitdiff
path: root/rs
diff options
context:
space:
mode:
authorYang Ni <yangni@google.com>2017-04-28 08:49:01 -0700
committerYang Ni <yangni@google.com>2017-05-05 15:32:34 +0000
commitc48a09cce85cbaeeaa75f9697807773bb99487eb (patch)
tree0722af39d21016d290b73dc5f4e65105b7119b6b /rs
parent31fb17bbf92bcbd16222b072d508366ac883d50a (diff)
Destroy Allocation right away on exception
Bug: 28053584 To avoid holding the resource (surface) for too long. Test: CTS on x86_64 emulator Change-Id: I2fdec107c2a16b7dadbf78a9aee79c33423a3676
Diffstat (limited to 'rs')
-rw-r--r--rs/java/android/renderscript/Allocation.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java
index 05ad1615dc81..238bf0f5a335 100644
--- a/rs/java/android/renderscript/Allocation.java
+++ b/rs/java/android/renderscript/Allocation.java
@@ -2895,6 +2895,7 @@ public class Allocation extends BaseObj {
mAllocationArray[0] = createTyped(rs, t, usage);
if ((usage & USAGE_IO_INPUT) != 0) {
if (numAlloc > MAX_NUMBER_IO_INPUT_ALLOC) {
+ mAllocationArray[0].destroy();
throw new RSIllegalArgumentException("Exceeds the max number of Allocations allowed: " +
MAX_NUMBER_IO_INPUT_ALLOC);
}