Fixing asynchronous performance issues.
Change-Id: I10f02cd37a33a6c655814d24e0a4291dc044fba3
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index b59ade8..a366d49 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -252,6 +252,7 @@
Allocation *alloc = Allocation::createAllocation(rsc, type, RS_ALLOCATION_USAGE_SCRIPT);
alloc->setName(name.string(), name.size());
+ type->decUserRef();
uint32_t count = dataSize / type->getElementSizeBytes();
@@ -307,12 +308,12 @@
return;
}
- Type *t = mHal.state.type->cloneAndResize1D(rsc, dimX);
+ ObjectBaseRef<Type> t = mHal.state.type->cloneAndResize1D(rsc, dimX);
if (dimX < oldDimX) {
decRefs(getPtr(), oldDimX - dimX, dimX);
}
- rsc->mHal.funcs.allocation.resize(rsc, this, t, mHal.state.hasReferences);
- mHal.state.type.set(t);
+ rsc->mHal.funcs.allocation.resize(rsc, this, t.get(), mHal.state.hasReferences);
+ mHal.state.type.set(t.get());
updateCache();
}