Validate objects are from the correct context.

Change-Id: I7d87b0e253b8d2e36d1aed790cfe3a7dd23e158f
This commit is contained in:
Jason Sams
2014-03-05 16:09:02 -08:00
parent 22f66b76f5
commit 678cc7fe9f
2 changed files with 17 additions and 0 deletions

View File

@ -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.");