FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0070 — FhSimUI segfaults after it reports a failed render system initialisation
ID 0070
Class BUG
Severity 1
Status ready

Models: —

Found: 2026-10-21, WSLg (Debian), FhSimUI of feature/recycle (fhsim 3.4.0, Ogre 14.6.1)

Decision needed: none; needs a reproduction first.

Evidence

Started without an input file (browser mode) while OpenGL did not work in that WSLg session (eglinfo also failed: eglInitialize failed), FhSimUI printed

FhSim caught an exception: RenderingAPIException: Couldn`t initialize EGLDisplay in EGLSupport::getGLDisplay at .../OgreEGLSupport.cpp (line 103)

and then ended with Segmentation fault (exit 139) instead of exit code 1.

The handler that prints this is src/apps/fhSimUI/FhSimUIMain.cpp:347; it returns 1. So the crash comes after the exception was handled: during stack unwinding of the objects in that try block (FhVisualizationSDL, PrintDuringExec) or during static destruction, after Ogre's render system failed half way through initApp().

After a reboot (graphics driver update) OpenGL worked again and the crash could not be reproduced. Starting without DISPLAY and WAYLAND_DISPLAY did not reproduce it either.

Effect

A crash report instead of a clean error exit when the machine has no working OpenGL. The error message is printed before the crash, so the cause is still visible.

Possible fix

Reproduce with a render system that throws in initApp() (for example a plugins.cfg that loads only a render system that cannot start), then run it in a debugger. Likely candidates: a destructor of FhVisualizationSDL or OgreBites::ApplicationContext that uses a root, window or ImGui context that was never created, or closeApp() called on a half-initialised context.

Test that would prove it

A gui-labelled test that starts FhSimUI with a render system that fails to initialise and expects exit code 1, not a signal.

Risk

Low: only the shutdown path after a failed start.