FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0134 — Move Ogre release from destructors to RenderRelease()
ID 0134
Class ARCHITECTURE
Severity 1
Status ready

Models: Auv, SensorEchosounder

Found: 2026-11-03, documentation review follow-up (doc/reviews/fhsim_fishery-2026-10-24, D9)

Evidence

fhsim declares virtual void RenderRelease() { } under FH_VISUALIZATION (../fhsim/include/fhsim/simobject/SimObjectInclude.h:352). It is called once, while the Ogre root and scene manager are still alive, before the visualisation observer shuts Ogre down. conanfile.py:24 requires fhsim >=3.4.3, so the hook is available. Fishery does not use it (grep -rn RenderRelease src is empty). Instead Auv::~Auv (src/auv/Auv.cpp:336) and SensorEchosounder::~SensorEchosounder (src/auv/SensorEchosounder.cpp:259) release their Ogre objects in the destructor, which runs after Ogre is gone, and guard the release with SceneIsStillAlive (Auv.cpp:49, used at :343; SensorEchosounder.cpp:69, used at :272). AGENTS.md ("Ogre teardown guard") keeps the guard until this is done. FISH-0041 (resolved) introduced the guard.

Effect

None for a user. A new object that releases Ogre objects must copy the guard, and an unguarded release segfaults every visualised run on exit.

Possible fix

Move the release code of both destructors into RenderRelease() overrides (under FH_VISUALIZATION), drop SceneIsStillAlive and its two uses, then reword the AGENTS.md section: release in RenderRelease, never in a destructor.

Test that would prove it

The visualised-exit test of FISH-0041 must pass with the release in RenderRelease() and the guards removed.

Risk

Low. Visualisation builds only; a release that is missed leaks the Ogre entity until the scene manager goes.