offline_viewer Crash on start
Description:
When running rosrun glim_ros offline_viewer in GLIM, the application crashes with a segmentation fault. At startup, the application prompts the user to specify a directory to save the map. If the user attempts to save the map before mapping has started (i.e., before any sensor data has been processed), the application crashes. This appears to be caused by a null pointer dereference in AsyncGlobalMapping::save.
Steps to Reproduce:
- Launch the application with:
rosrun glim_ros offline_viewer - At startup, when prompted to define a directory to save the map, provide a path and proceed to click Save Map (or trigger the save functionality).
- The application immediately crashes before any mapping data is processed.
Observed Behavior:
The application crashes with the following error:
Thread 7 "offline_viewer" received signal SIGSEGV, Segmentation fault.
glim::AsyncGlobalMapping::save (this=0x0, path="/root/data")
Backtrace:
#0 glim::AsyncGlobalMapping::save (this=0x0, path="/root/data")
at src/glim/mapping/async_global_mapping.cpp:64
#1 glim::OfflineViewer::save_map (...)
...
Environment:
- ROS Noetic
- Ubuntu 20.04 (Docker)
- GLIM version: [commit hash or tag, if available]
Video:
A short video demonstrating the crash is attached to this issue.
https://github.com/user-attachments/assets/d327dba3-d8a5-4c0b-8841-e62be981b596
Thanks for reporting the bug. https://github.com/koide3/glim/pull/218 should fix the issue.