mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-14 19:02:43 +02:00
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.
This commit is contained in:
parent
bd5d1688b4
commit
6af51e8198
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user