summaryrefslogtreecommitdiff
path: root/libs/rs/rsProgram.cpp
diff options
context:
space:
mode:
author Jason Sams <rjsams@android.com> 2011-08-18 18:01:33 -0700
committer Jason Sams <rjsams@android.com> 2011-08-18 18:01:33 -0700
commit777ec2662ef5ee8b0a501e0b8a9b2d7a2b84ffe7 (patch)
treed1c4914169163c551f1eee01081528d29aee5aa0 /libs/rs/rsProgram.cpp
parent85deb781658e870556c305c523fa7f2bf679efe3 (diff)
Fix issue with freeing allocation with circular references.
Change-Id: I45871c20a192815eafee77f95e17a025f6dcf9d1
Diffstat (limited to 'libs/rs/rsProgram.cpp')
-rw-r--r--libs/rs/rsProgram.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/libs/rs/rsProgram.cpp b/libs/rs/rsProgram.cpp
index 33eb422e3354..4178aa5b547e 100644
--- a/libs/rs/rsProgram.cpp
+++ b/libs/rs/rsProgram.cpp
@@ -70,15 +70,8 @@ Program::Program(Context *rsc, const char * shaderText, uint32_t shaderLength,
}
Program::~Program() {
+ freeChildren();
- for (uint32_t ct=0; ct < mHal.state.constantsCount; ct++) {
- bindAllocation(NULL, NULL, ct);
- }
-
- for (uint32_t ct=0; ct < mHal.state.texturesCount; ct++) {
- bindTexture(NULL, ct, NULL);
- bindSampler(NULL, ct, NULL);
- }
delete[] mHal.state.textures;
delete[] mHal.state.samplers;
delete[] mHal.state.textureTargets;
@@ -90,6 +83,18 @@ Program::~Program() {
mHal.state.texturesCount = 0;
}
+bool Program::freeChildren() {
+ for (uint32_t ct=0; ct < mHal.state.constantsCount; ct++) {
+ bindAllocation(NULL, NULL, ct);
+ }
+
+ for (uint32_t ct=0; ct < mHal.state.texturesCount; ct++) {
+ bindTexture(NULL, ct, NULL);
+ bindSampler(NULL, ct, NULL);
+ }
+ return false;
+}
+
void Program::initMemberVars() {
mDirty = true;