diff options
author | Yang Ni <yangni@google.com> | 2016-03-31 22:56:37 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-03-31 22:56:37 +0000 |
commit | 64c4c1c1cd24157f93dc3f07f7dff299b7d0c8f8 (patch) | |
tree | 83dfd405db4ede4bddd3984c4ae33c25fa0cb604 /rs/java/android/renderscript/Allocation.java | |
parent | 410144887ec32d2bfc10554effce4f7d512ea568 (diff) | |
parent | eb4dd08ec132f83745b8b28fa7da58eb4478b5b9 (diff) |
Merge "Added CloseGuard for BaseObj"
Diffstat (limited to 'rs/java/android/renderscript/Allocation.java')
-rw-r--r-- | rs/java/android/renderscript/Allocation.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java index b9c5738a0936..b303b4892565 100644 --- a/rs/java/android/renderscript/Allocation.java +++ b/rs/java/android/renderscript/Allocation.java @@ -380,6 +380,7 @@ public class Allocation extends BaseObj { Log.e(RenderScript.LOG_TAG, "Couldn't invoke registerNativeAllocation:" + e); throw new RSRuntimeException("Couldn't invoke registerNativeAllocation:" + e); } + guard.open("destroy"); } Allocation(long id, RenderScript rs, Type t, int usage, MipmapControl mips) { @@ -1915,6 +1916,7 @@ public class Allocation extends BaseObj { if (type.getID(rs) == 0) { throw new RSInvalidStateException("Bad Type"); } + // TODO: What if there is an exception after this? The native allocation would leak. long id = rs.nAllocationCreateTyped(type.getID(rs), mips.mID, usage, 0); if (id == 0) { throw new RSRuntimeException("Allocation creation failed."); |