From b5e10a426f78288a260f08d0581af2d19c817724 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Thu, 17 Aug 2023 22:33:50 +0000 Subject: [PATCH] unload engine in gzrenderer Signed-off-by: Ian Chen --- src/plugins/minimal_scene/MinimalScene.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/minimal_scene/MinimalScene.cc b/src/plugins/minimal_scene/MinimalScene.cc index b80c7af98..5860ff5fd 100644 --- a/src/plugins/minimal_scene/MinimalScene.cc +++ b/src/plugins/minimal_scene/MinimalScene.cc @@ -679,6 +679,10 @@ void GzRenderer::Destroy() return; scene->DestroySensor(this->dataPtr->camera); + // clean up in the rendering thread + this->dataPtr->camera.reset(); + this->dataPtr->rayQuery.reset(); + // If that was the last sensor, destroy scene if (scene->SensorCount() == 0) { @@ -686,11 +690,10 @@ void GzRenderer::Destroy() engine->DestroyScene(scene); // TODO(anyone) If that was the last scene, terminate engine? + if (engine->SceneCount() == 0) + rendering::unloadEngine(engine->Name()); } - // clean up in the rendering thread - this->dataPtr->camera.reset(); - this->dataPtr->rayQuery.reset(); std::cerr << "================ GzRenderer Destroy " << std::endl; }