diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-04-24 18:26:12 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-04-24 18:26:12 +0000 |
commit | c46ffabe6e727c656d241d5642df88b722714eca (patch) | |
tree | 30a143a7775e55bf719e8574f25bb0cf52c24569 | |
parent | e7f29927fd0d650d184c5f8d76db69634185c147 (diff) | |
parent | cf51dd13955c1eab521a2a610d1c7ca26fc01e05 (diff) | |
download | rs-c46ffabe6e727c656d241d5642df88b722714eca.tar.gz |
Merge "Increment sys ref count of input/output Allocations" into oc-dev
-rw-r--r-- | driver/rsdRuntimeStubs.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/driver/rsdRuntimeStubs.cpp b/driver/rsdRuntimeStubs.cpp index 504f0980..74c79182 100644 --- a/driver/rsdRuntimeStubs.cpp +++ b/driver/rsdRuntimeStubs.cpp @@ -683,10 +683,23 @@ void rsForEachInternal(int slot, Allocation* inputs[RS_KERNEL_MAX_ARGUMENTS]; for (int i = 0; i < numInputs; i++) { inputs[i] = (Allocation*)allocs[i].p; + CHECK_OBJ(inputs[i]); + inputs[i]->incSysRef(); + } + Allocation* out = nullptr; + if (hasOutput) { + out = (Allocation*)allocs[numInputs].p; + CHECK_OBJ(out); + out->incSysRef(); } - Allocation* out = hasOutput ? (Allocation*)allocs[numInputs].p : nullptr; rsrForEach(rsc, s, slot, numInputs, numInputs > 0 ? inputs : nullptr, out, nullptr, 0, (RsScriptCall*)options); + for (int i = 0; i < numInputs; i++) { + inputs[i]->decSysRef(); + } + if (hasOutput) { + out->decSysRef(); + } } void __attribute__((overloadable)) rsForEach(::rs_script script, |