Implement OOB destroy method that can be called from the java finalizer removing the need to explicitly destroy objects.

This commit is contained in:
Jason Sams
2009-08-18 17:07:09 -07:00
parent 7ce033d797
commit 730ee65d4d
7 changed files with 107 additions and 11 deletions

View File

@@ -60,8 +60,13 @@ class BaseObj {
protected void finalize() throws Throwable
{
if (!mDestroyed) {
if(mID != 0) {
mRS.nObjDestroyOOB(mID);
}
mID = 0;
mDestroyed = true;
Log.v(RenderScript.LOG_TAG,
getClass() + " finalized without having released the RS reference.");
getClass() + " auto finalizing object without having released the RS reference.");
}
super.finalize();
}