diff options
author | Jason Sams <rjsams@android.com> | 2009-09-25 14:51:22 -0700 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2009-09-25 14:51:22 -0700 |
commit | a9e7a05b84470257637c97d65f6562aa832c66ef (patch) | |
tree | 04a3175485ae7492c3387003c244953b6880c514 /graphics | |
parent | a0cad2f5d19d95cfe496ebb82f3227dd4ed7c169 (diff) | |
download | frameworks_base-a9e7a05b84470257637c97d65f6562aa832c66ef.zip frameworks_base-a9e7a05b84470257637c97d65f6562aa832c66ef.tar.gz frameworks_base-a9e7a05b84470257637c97d65f6562aa832c66ef.tar.bz2 |
Improve renderscript context teardown. Track object in the system and then force their cleanup by releasing all user references once destroy context is called. Java layer will no longer send destroy notifications for objects garbage collected once a context is destroyed.
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/renderscript/BaseObj.java | 3 | ||||
-rw-r--r-- | graphics/java/android/renderscript/RenderScript.java | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/graphics/java/android/renderscript/BaseObj.java b/graphics/java/android/renderscript/BaseObj.java index c25f16a..c626d5d 100644 --- a/graphics/java/android/renderscript/BaseObj.java +++ b/graphics/java/android/renderscript/BaseObj.java @@ -60,9 +60,10 @@ class BaseObj { protected void finalize() throws Throwable { if (!mDestroyed) { - if(mID != 0) { + if(mID != 0 && mRS.isAlive()) { mRS.nObjDestroyOOB(mID); } + mRS = null; mID = 0; mDestroyed = true; Log.v(RenderScript.LOG_TAG, diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index f815f52..ed61691 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -219,6 +219,10 @@ public class RenderScript { mDev = 0; } + boolean isAlive() { + return mContext != 0; + } + void pause() { nContextPause(); } |