aboutsummaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
authorAva Chow <github@achow101.com>2024-07-06 13:00:53 -0400
committerAva Chow <github@achow101.com>2024-07-06 13:00:53 -0400
commit6af51e819847e737449609daa214e16f9453e85d (patch)
tree69e8de24cbd4673f9e4ea89bb085723eb941c028 /src/node
parentbd5d1688b4311e21c0e0ff89a3ae02ef7d0543b8 (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.cpp3
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;
}