Reduces reference counts of the continuation task and the dependent tasks, also clearing the copy of continuation and dependents task list. */
| 195 | clearing the copy of continuation and dependents task list. |
| 196 | */ |
| 197 | virtual void release() |
| 198 | { |
| 199 | Ps::InlineArray<physx::PxBaseTask*, 10> referencesToRemove; |
| 200 | |
| 201 | { |
| 202 | shdfnd::Mutex::ScopedLock lock(mMutex); |
| 203 | |
| 204 | const PxU32 contCount = mReferencesToRemove.size(); |
| 205 | referencesToRemove.reserve(contCount); |
| 206 | for (PxU32 i=0; i < contCount; ++i) |
| 207 | referencesToRemove.pushBack(mReferencesToRemove[i]); |
| 208 | |
| 209 | mReferencesToRemove.clear(); |
| 210 | // allow access to mReferencesToRemove again |
| 211 | if (mNotifySubmission) |
| 212 | { |
| 213 | removeReference(); |
| 214 | } |
| 215 | else |
| 216 | { |
| 217 | physx::shdfnd::atomicDecrement(&mRefCount); |
| 218 | } |
| 219 | |
| 220 | // the scoped lock needs to get freed before the continuation tasks get (potentially) submitted because |
| 221 | // those continuation tasks might trigger events that delete this task and corrupt the memory of the |
| 222 | // mutex (for example, assume this task is a member of the scene then the submitted tasks cause the simulation |
| 223 | // to finish and then the scene gets released which in turn will delete this task. When this task then finally |
| 224 | // continues the heap memory will be corrupted. |
| 225 | } |
| 226 | |
| 227 | for (PxU32 i=0; i < referencesToRemove.size(); ++i) |
| 228 | referencesToRemove[i]->removeReference(); |
| 229 | } |
| 230 | |
| 231 | protected: |
| 232 | volatile PxI32 mRefCount; |
nothing calls this directly
no test coverage detected