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
This commit is contained in:
Bryce Seager van Dyk 2022-04-06 01:18:42 +00:00
Родитель d4353d63a9
Коммит 14c08205a6
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -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<ICustomDestinationList> jumpListMgr = mJumpListMgr;