summaryrefslogtreecommitdiff
path: root/rs/java/android/renderscript/RenderScript.java
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2014-03-05 16:09:02 -0800
committerJason Sams <jsams@google.com>2014-03-05 16:09:02 -0800
commit678cc7fe9fef00fb3381e64f95cc6907796bcd8e (patch)
treeffaba9543cfbc5de64b73b6b895a63ffef87bd87 /rs/java/android/renderscript/RenderScript.java
parent22f66b76f5e49704f3be76ad3fff7e4b5456864d (diff)
Validate objects are from the correct context.
Change-Id: I7d87b0e253b8d2e36d1aed790cfe3a7dd23e158f
Diffstat (limited to 'rs/java/android/renderscript/RenderScript.java')
-rw-r--r--rs/java/android/renderscript/RenderScript.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java
index 7db331f0ab0c..eebeaa4ff8cc 100644
--- a/rs/java/android/renderscript/RenderScript.java
+++ b/rs/java/android/renderscript/RenderScript.java
@@ -1004,6 +1004,14 @@ public class RenderScript {
}
}
+ void validateObject(BaseObj o) {
+ if (o != null) {
+ if (o.mRS != this) {
+ throw new RSIllegalArgumentException("Attempting to use an object across contexts.");
+ }
+ }
+ }
+
void validate() {
if (mContext == 0) {
throw new RSInvalidStateException("Calling RS with no Context active.");