Skip to content

Commit a83f050

Browse files
committed
Merge bitcoin/bitcoin#30404: Use WITH_LOCK in Warnings::Set
6af51e8 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 6af51e8 TheCharlatan: ACK 6af51e8 glozow: ACK 6af51e8 willcl-ark: ACK 6af51e8 stickies-v: ACK 6af51e8 Tree-SHA512: 9884046c70dcad996276931b6d154f0330200332403828f34f7f7b285fc0e770ba7b25056131ab24dcb8a4b18f58d31633aa17fbb09b0eaea8a29e28fca10ec4
2 parents e53a3fb + 6af51e8 commit a83f050

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/node/warnings.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ Warnings::Warnings()
2828
}
2929
bool Warnings::Set(warning_type id, bilingual_str message)
3030
{
31-
LOCK(m_mutex);
32-
const auto& [_, inserted]{m_warnings.insert({id, std::move(message)})};
31+
const auto& [_, inserted]{WITH_LOCK(m_mutex, return m_warnings.insert({id, std::move(message)}))};
3332
if (inserted) uiInterface.NotifyAlertChanged();
3433
return inserted;
3534
}

0 commit comments

Comments
 (0)