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.
diff --git a/libs/rs/rsComponent.cpp b/libs/rs/rsComponent.cpp
index 4a043f3..67184ff 100644
--- a/libs/rs/rsComponent.cpp
+++ b/libs/rs/rsComponent.cpp
@@ -21,7 +21,7 @@
using namespace android::renderscript;
-Component::Component()
+Component::Component(Context *rsc) : ObjectBase(rsc)
{
mType = FLOAT;
mKind = USER;
@@ -29,9 +29,9 @@
mBits = 0;
}
-Component::Component(
+Component::Component(Context *rsc,
DataKind dk, DataType dt,
- bool isNormalized, uint32_t bits, const char * name)
+ bool isNormalized, uint32_t bits, const char * name) : ObjectBase(rsc)
{
mType = dt;
mKind = dk;