From 6af51e819847e737449609daa214e16f9453e85d Mon Sep 17 00:00:00 2001 From: Ava Chow Date: Sat, 6 Jul 2024 13:00:53 -0400 Subject: Use WITH_LOCK in Warnings::Set The scope of the lock should be limited to just guarding m_warnings as anything listening on `NotifyAlertChanged` may execute code that requires the lock as well. --- src/node/warnings.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/node') diff --git a/src/node/warnings.cpp b/src/node/warnings.cpp index b99c845900..87389e472b 100644 --- a/src/node/warnings.cpp +++ b/src/node/warnings.cpp @@ -28,8 +28,7 @@ Warnings::Warnings() } bool Warnings::Set(warning_type id, bilingual_str message) { - LOCK(m_mutex); - const auto& [_, inserted]{m_warnings.insert({id, std::move(message)})}; + const auto& [_, inserted]{WITH_LOCK(m_mutex, return m_warnings.insert({id, std::move(message)}))}; if (inserted) uiInterface.NotifyAlertChanged(); return inserted; } -- cgit v1.2.3