Add object validity checking.

Change-Id: I2613e87b09a6e560f0381d4ed620d60a10bc30e4
diff --git a/rsObjectBase.cpp b/rsObjectBase.cpp
index 713d61e..f69cb15 100644
--- a/rsObjectBase.cpp
+++ b/rsObjectBase.cpp
@@ -195,3 +195,15 @@
     }
 }
 
+bool ObjectBase::isValid(const Context *rsc, const ObjectBase *obj)
+{
+    const ObjectBase * o = rsc->mObjHead;
+    while (o) {
+        if (o == obj) {
+            return true;
+        }
+        o = o->mNext;
+    }
+    return false;
+}
+