diff options
author | Ava Chow <github@achow101.com> | 2024-07-06 13:00:53 -0400 |
---|---|---|
committer | Ava Chow <github@achow101.com> | 2024-07-06 13:00:53 -0400 |
commit | 6af51e819847e737449609daa214e16f9453e85d (patch) | |
tree | 69e8de24cbd4673f9e4ea89bb085723eb941c028 /src/node | |
parent | bd5d1688b4311e21c0e0ff89a3ae02ef7d0543b8 (diff) |
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.
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/warnings.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
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; } |