Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 623cb958 authored by Stephen Hines's avatar Stephen Hines
Browse files

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
parent 70a17055
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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;