mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-24 23:52:00 +02:00
Merge bitcoin/bitcoin#30404: Use WITH_LOCK
in Warnings::Set
6af51e819847e737449609daa214e16f9453e85d Use WITH_LOCK in Warnings::Set (Ava Chow) Pull request description: 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. Fixes #30400 ACKs for top commit: maflcko: lgtm ACK 6af51e819847e737449609daa214e16f9453e85d TheCharlatan: ACK 6af51e819847e737449609daa214e16f9453e85d glozow: ACK 6af51e819847e737449609daa214e16f9453e85d willcl-ark: ACK 6af51e819847e737449609daa214e16f9453e85d stickies-v: ACK 6af51e819847e737449609daa214e16f9453e85d Tree-SHA512: 9884046c70dcad996276931b6d154f0330200332403828f34f7f7b285fc0e770ba7b25056131ab24dcb8a4b18f58d31633aa17fbb09b0eaea8a29e28fca10ec4
This commit is contained in:
commit
a83f050dbe
@ -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