diff --git a/include/gz/sim/rendering/Events.hh b/include/gz/sim/rendering/Events.hh index 132f9baa92..786092a33a 100644 --- a/include/gz/sim/rendering/Events.hh +++ b/include/gz/sim/rendering/Events.hh @@ -77,6 +77,18 @@ namespace gz using PostRender = gz::common::EventT; + /// \brief The render teardown event is emitted right before the + /// rendering thread is torn down. The event is emitted in the + /// rendering thread so last minute, cleanup rendering calls can + /// be made in this event callback. + /// + /// For example: + /// \code + /// eventManager.Emit(); + /// \endcode + using RenderTeardown = gz::common::EventT; + /// \brief The force render event may be emitted outside the /// rendering thread to force rendering calls ie. to ensure /// rendering occurs even if it wasn't seemingly necessary. diff --git a/src/systems/sensors/Sensors.cc b/src/systems/sensors/Sensors.cc index 9ad21e8f52..f5ca4d27f7 100644 --- a/src/systems/sensors/Sensors.cc +++ b/src/systems/sensors/Sensors.cc @@ -396,6 +396,8 @@ void SensorsPrivate::RenderThread() this->RunOnce(); } + this->eventManager->Emit(); + // clean up before exiting for (const auto id : this->sensorIds) this->sensorManager.Remove(id);