From 28daeac06dc18a2182c0cb7e8de83985a70274ab Mon Sep 17 00:00:00 2001 From: Doug Thayer Date: Fri, 27 Mar 2020 21:00:24 +0000 Subject: [PATCH] Bug 1595596 - Always wait on Prefetch thread before touching mCacheData r=froydnj This is not, AFAICT, causing crashes - it is just an oversight noticed while investigating the crash in the bug. Differential Revision: https://phabricator.services.mozilla.com/D53042 --HG-- extra : moz-landing-system : lando --- startupcache/StartupCache.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/startupcache/StartupCache.cpp b/startupcache/StartupCache.cpp index 1cf954a0d65f..1780ce8b8292 100644 --- a/startupcache/StartupCache.cpp +++ b/startupcache/StartupCache.cpp @@ -276,6 +276,7 @@ Result StartupCache::LoadArchive() { return Err(NS_ERROR_UNEXPECTED); } auto cleanup = MakeScopeExit([&]() { + WaitOnPrefetchThread(); mTable.clear(); mCacheData.reset(); }); @@ -564,6 +565,7 @@ Result StartupCache::WriteToDisk() { void StartupCache::InvalidateCache(bool memoryOnly) { WaitOnWriteThread(); + WaitOnPrefetchThread(); mWrittenOnce = false; if (memoryOnly) { auto writeResult = WriteToDisk();