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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user