From a57e982785d318ddcaa4d86486d63343acefa3fb Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Fri, 25 Sep 2009 16:50:36 -0700 Subject: [PATCH] Fix remaining object leaks. Change FountainView to tear down the rsContext and recreate on rotation to test teardown. --- .../src/com/android/fountain/FountainView.java | 13 ------------- libs/rs/rsType.cpp | 1 + libs/rs/rsType.h | 6 ------ 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/libs/rs/java/Fountain/src/com/android/fountain/FountainView.java b/libs/rs/java/Fountain/src/com/android/fountain/FountainView.java index 116afd0c3dbb8..cda005e06930d 100644 --- a/libs/rs/java/Fountain/src/com/android/fountain/FountainView.java +++ b/libs/rs/java/Fountain/src/com/android/fountain/FountainView.java @@ -42,7 +42,6 @@ public class FountainView extends RSSurfaceView { public FountainView(Context context) { super(context); - //setFocusable(true); } @@ -59,11 +58,7 @@ public class FountainView extends RSSurfaceView { public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { super.surfaceChanged(holder, format, w, h); - - Log.e("rs", "surfaceChanged"); destroyRS(); - - mRS = createRenderScript(false, true); mRender = new FountainRS(); mRender.init(mRS, getResources(), w, h); @@ -71,15 +66,7 @@ public class FountainView extends RSSurfaceView { public void surfaceDestroyed(SurfaceHolder holder) { // Surface will be destroyed when we return - Log.v("rs", "surfaceDestroyed"); destroyRS(); - - try { - java.lang.Thread.sleep(5000); - } catch(InterruptedException e) { - - } - Runtime.getRuntime().exit(0); } diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp index 4edd0d4982b70..5ce9ca2341ef7 100644 --- a/libs/rs/rsType.cpp +++ b/libs/rs/rsType.cpp @@ -374,6 +374,7 @@ RsType rsi_TypeCreate(Context *rsc) st->setDimLOD(stc->mLOD); st->setDimFaces(stc->mFaces); st->compute(); + stc->mElement.clear(); return st; } diff --git a/libs/rs/rsType.h b/libs/rs/rsType.h index 087e50df88aca..116f1c74d6012 100644 --- a/libs/rs/rsType.h +++ b/libs/rs/rsType.h @@ -139,12 +139,6 @@ public: uint32_t mLOD; bool mFaces; ObjectBaseRef mElement; - - ObjectBaseRef mIndexType; - ObjectBaseRef mPrimitiveType; - ObjectBaseRef *mVertexTypes; - - };