summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2011-03-24 20:03:49 -0700
committerStephen Hines <srhines@google.com>2011-03-24 20:07:23 -0700
commit623cb9585e110ecc11b48a12bf4a02efd5293aaa (patch)
treefe69e75a96d2c2fbed30c369212950398b31c072 /libs
parent70a170555686f3288993fba86cf2f10ac22e8956 (diff)
downloadframeworks_base-623cb9585e110ecc11b48a12bf4a02efd5293aaa.zip
frameworks_base-623cb9585e110ecc11b48a12bf4a02efd5293aaa.tar.gz
frameworks_base-623cb9585e110ecc11b48a12bf4a02efd5293aaa.tar.bz2
Properly handle script teardown.
If libbcc optimizes away a global variable, we need to make sure that RenderScript's ~Context() doesn't attempt to clear away the slot's NULL pointer that denotes this. Change-Id: I77d0f740ab333338e53db481e4a3eca338aba411
Diffstat (limited to 'libs')
-rw-r--r--libs/rs/driver/rsdBcc.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/rs/driver/rsdBcc.cpp b/libs/rs/driver/rsdBcc.cpp
index 2038a4c..6c5a55b 100644
--- a/libs/rs/driver/rsdBcc.cpp
+++ b/libs/rs/driver/rsdBcc.cpp
@@ -522,7 +522,11 @@ void rsdScriptDestroy(const Context *dc, Script *script) {
if (drv->mFieldAddress) {
for (size_t ct=0; ct < drv->mFieldCount; ct++) {
if (drv->mFieldIsObject[ct]) {
- rsiClearObject((ObjectBase **)&drv->mFieldAddress[ct]);
+ // The field address can be NULL if the script-side has
+ // optimized the corresponding global variable away.
+ if (drv->mFieldAddress[ct]) {
+ rsiClearObject((ObjectBase **)drv->mFieldAddress[ct]);
+ }
}
}
delete [] drv->mFieldAddress;