Loading rs/java/android/renderscript/RenderScript.java +35 −13 Original line number Diff line number Diff line Loading @@ -938,6 +938,8 @@ public class RenderScript { long mDev; long mContext; private boolean mDestroyed = false; @SuppressWarnings({"FieldCanBeLocal"}) MessageThread mMessageThread; Loading Loading @@ -1382,14 +1384,16 @@ public class RenderScript { nContextFinish(); } /** * Destroys this RenderScript context. Once this function is called, * using this context or any objects belonging to this context is * illegal. * */ public void destroy() { validate(); private void helpDestroy() { boolean shouldDestroy = false; synchronized(this) { if (!mDestroyed) { shouldDestroy = true; mDestroyed = true; } } if (shouldDestroy) { nContextFinish(); nContextDeinitToClient(mContext); Loading @@ -1404,6 +1408,24 @@ public class RenderScript { nDeviceDestroy(mDev); mDev = 0; } } protected void finalize() throws Throwable { helpDestroy(); super.finalize(); } /** * Destroys this RenderScript context. Once this function is called, * using this context or any objects belonging to this context is * illegal. * */ public void destroy() { validate(); helpDestroy(); } boolean isAlive() { return mContext != 0; Loading Loading
rs/java/android/renderscript/RenderScript.java +35 −13 Original line number Diff line number Diff line Loading @@ -938,6 +938,8 @@ public class RenderScript { long mDev; long mContext; private boolean mDestroyed = false; @SuppressWarnings({"FieldCanBeLocal"}) MessageThread mMessageThread; Loading Loading @@ -1382,14 +1384,16 @@ public class RenderScript { nContextFinish(); } /** * Destroys this RenderScript context. Once this function is called, * using this context or any objects belonging to this context is * illegal. * */ public void destroy() { validate(); private void helpDestroy() { boolean shouldDestroy = false; synchronized(this) { if (!mDestroyed) { shouldDestroy = true; mDestroyed = true; } } if (shouldDestroy) { nContextFinish(); nContextDeinitToClient(mContext); Loading @@ -1404,6 +1408,24 @@ public class RenderScript { nDeviceDestroy(mDev); mDev = 0; } } protected void finalize() throws Throwable { helpDestroy(); super.finalize(); } /** * Destroys this RenderScript context. Once this function is called, * using this context or any objects belonging to this context is * illegal. * */ public void destroy() { validate(); helpDestroy(); } boolean isAlive() { return mContext != 0; Loading