[v3.6.0] Fix memory leaks (#12185)

This commit is contained in:
James Chen
2022-07-26 18:01:53 +08:00
committed by GitHub
parent 79f2b97827
commit d553ce2bdb
4 changed files with 15 additions and 5 deletions
@@ -47,7 +47,9 @@ PlanarShadowQueue::PlanarShadowQueue(RenderPipeline *pipeline)
_instancedQueue = ccnew RenderInstancedQueue;
}
PlanarShadowQueue::~PlanarShadowQueue() = default;
PlanarShadowQueue::~PlanarShadowQueue() {
destroy();
}
void PlanarShadowQueue::gatherShadowPasses(scene::Camera *camera, gfx::CommandBuffer *cmdBuffer) {
clear();
@@ -138,7 +140,10 @@ void PlanarShadowQueue::recordCommandBuffer(gfx::Device *device, gfx::RenderPass
}
void PlanarShadowQueue::destroy() {
_pipeline = nullptr;
CC_SAFE_DELETE(_instancedQueue);
_castModels.clear();
_pendingModels.clear();
}
} // namespace pipeline