From a9e7a05b84470257637c97d65f6562aa832c66ef Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Fri, 25 Sep 2009 14:51:22 -0700 Subject: 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. --- libs/rs/rsAdapter.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libs/rs/rsAdapter.cpp') diff --git a/libs/rs/rsAdapter.cpp b/libs/rs/rsAdapter.cpp index d20e910..9a3bbb1 100644 --- a/libs/rs/rsAdapter.cpp +++ b/libs/rs/rsAdapter.cpp @@ -21,12 +21,12 @@ using namespace android; using namespace android::renderscript; -Adapter1D::Adapter1D() +Adapter1D::Adapter1D(Context *rsc) : ObjectBase(rsc) { reset(); } -Adapter1D::Adapter1D(Allocation *a) +Adapter1D::Adapter1D(Context *rsc, Allocation *a) : ObjectBase(rsc) { reset(); setAllocation(a); @@ -71,7 +71,7 @@ namespace renderscript { RsAdapter1D rsi_Adapter1DCreate(Context *rsc) { - Adapter1D *a = new Adapter1D(); + Adapter1D *a = new Adapter1D(rsc); a->incUserRef(); return a; } @@ -125,12 +125,12 @@ void rsi_Adapter1DData(Context *rsc, RsAdapter1D va, const void *data) ////////////////////////// -Adapter2D::Adapter2D() +Adapter2D::Adapter2D(Context *rsc) : ObjectBase(rsc) { reset(); } -Adapter2D::Adapter2D(Allocation *a) +Adapter2D::Adapter2D(Context *rsc, Allocation *a) : ObjectBase(rsc) { reset(); setAllocation(a); @@ -184,7 +184,7 @@ namespace renderscript { RsAdapter2D rsi_Adapter2DCreate(Context *rsc) { - Adapter2D *a = new Adapter2D(); + Adapter2D *a = new Adapter2D(rsc); a->incUserRef(); return a; } -- cgit v1.1