diff options
| author | Stephen Hines <srhines@google.com> | 2011-03-24 20:03:49 -0700 |
|---|---|---|
| committer | Stephen Hines <srhines@google.com> | 2011-03-24 20:07:23 -0700 |
| commit | 8d43eafdd2684b7bcb2554e65676dc914b7eabd7 (patch) | |
| tree | f315f1fb793d0f853c8158aa655cf94d4d3b3047 /driver | |
| parent | 6f6bf8ee67db7c0741b57f194bbfd957981a4df5 (diff) | |
| download | android_frameworks_rs-8d43eafdd2684b7bcb2554e65676dc914b7eabd7.tar.gz android_frameworks_rs-8d43eafdd2684b7bcb2554e65676dc914b7eabd7.tar.bz2 android_frameworks_rs-8d43eafdd2684b7bcb2554e65676dc914b7eabd7.zip | |
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 'driver')
| -rw-r--r-- | driver/rsdBcc.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/driver/rsdBcc.cpp b/driver/rsdBcc.cpp index 2038a4c0..6c5a55be 100644 --- a/driver/rsdBcc.cpp +++ b/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; |
