From 5e6a351bdd16eb6c304425728a8635498dc656eb Mon Sep 17 00:00:00 2001 From: Dee HY Date: Tue, 20 Jan 2026 21:39:14 +0800 Subject: [PATCH] Fix -Wdangling-capture warning in CalcEngine::GetString() Store the temporary std::wstring object in a local variable before using it as a key for the unordered_map lookup. This prevents the compiler warning about capturing a reference to an object that will be destroyed at the end of the full-expression. --- src/CalcManager/Header Files/CalcEngine.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CalcManager/Header Files/CalcEngine.h b/src/CalcManager/Header Files/CalcEngine.h index eaa2956b4e..f92519a657 100644 --- a/src/CalcManager/Header Files/CalcEngine.h +++ b/src/CalcManager/Header Files/CalcEngine.h @@ -97,7 +97,8 @@ class CCalcEngine // returns the ptr to string representing the operator. Mostly same as the button, but few special cases for x^y etc. static std::wstring_view GetString(int ids) { - return s_engineStrings[std::to_wstring(ids)]; + std::wstring key = std::to_wstring(ids); + return s_engineStrings.at(key); } static std::wstring_view GetString(std::wstring_view ids) {