From 14c08205a60cedde54a52f497942daedadb03702 Mon Sep 17 00:00:00 2001 From: Bryce Seager van Dyk Date: Wed, 6 Apr 2022 01:18:42 +0000 Subject: [PATCH] Bug 1762521 - Add further locking to JumpListBuilder. r=mhowell,jesup This fixes two cases where thread safety analysis complains about us not holding the monitor. Differential Revision: https://phabricator.services.mozilla.com/D142775 --- widget/windows/JumpListBuilder.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/widget/windows/JumpListBuilder.cpp b/widget/windows/JumpListBuilder.cpp index ff0797f39504..b74c3f1529cd 100644 --- a/widget/windows/JumpListBuilder.cpp +++ b/widget/windows/JumpListBuilder.cpp @@ -107,6 +107,7 @@ JumpListBuilder::JumpListBuilder() return; } + ReentrantMonitorAutoEnter lock(mMonitor); // Since we are accessing mJumpListMgr across different threads // (ie, different apartments), mJumpListMgr must be an agile reference. mJumpListMgr = jumpListMgr; @@ -140,6 +141,7 @@ JumpListBuilder::~JumpListBuilder() { NS_IMETHODIMP JumpListBuilder::SetAppUserModelID( const nsAString& aAppUserModelId) { + ReentrantMonitorAutoEnter lock(mMonitor); if (!mJumpListMgr) return NS_ERROR_NOT_AVAILABLE; RefPtr jumpListMgr = mJumpListMgr;