From 8832d6a7c298c7e24dd5b8432161781b57f973c9 Mon Sep 17 00:00:00 2001 From: Gold856 <117957790+Gold856@users.noreply.github.com> Date: Thu, 7 May 2026 23:03:28 -0400 Subject: [PATCH] [sim] GUI: Fix game message string lifetime (#8874) Fixes an issue where game data can't be set. --- .../halsim_gui/src/main/native/cpp/DriverStationGui.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/simulation/halsim_gui/src/main/native/cpp/DriverStationGui.cpp b/simulation/halsim_gui/src/main/native/cpp/DriverStationGui.cpp index f00b3614d7..359df8fbe4 100644 --- a/simulation/halsim_gui/src/main/native/cpp/DriverStationGui.cpp +++ b/simulation/halsim_gui/src/main/native/cpp/DriverStationGui.cpp @@ -1294,8 +1294,9 @@ void FMSSimModel::UpdateHAL() { HALSIM_SetDriverStationRobotMode( static_cast(m_robotMode.GetValue())); HALSIM_SetDriverStationMatchTime(m_matchTime.GetValue()); - auto str = wpi::util::make_string(m_gameMessage.GetValue()); - HALSIM_SetGameDataString(&str); + std::string str = m_gameMessage.GetValue(); + auto gameData = wpi::util::make_string(str); + HALSIM_SetGameDataString(&gameData); HALSIM_SetDriverStationDsAttached(m_dsAttached.GetValue()); }