From 633516160e7c752941eaf058109a8859ad9495ef Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Mon, 7 Apr 2025 21:01:22 -0400 Subject: [SharedCache] Don't process shared cache when view is not file backed This fixes a case where the remote file is downloaded and the shared cache view is selected, we _only_ work for file backed views, as our shared cache specific file accessors work on those. So this is not a loss in functionality. In the future if we wanted to load shared caches without touching disk (yikes) than we would need to remove this restriction, or provide a way in the API for user to process their own cache entries (after view init). --- view/sharedcache/core/SharedCacheView.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'view/sharedcache/core/SharedCacheView.cpp') diff --git a/view/sharedcache/core/SharedCacheView.cpp b/view/sharedcache/core/SharedCacheView.cpp index 4ba44cc7..14a1670c 100644 --- a/view/sharedcache/core/SharedCacheView.cpp +++ b/view/sharedcache/core/SharedCacheView.cpp @@ -777,6 +777,16 @@ bool SharedCacheView::Init() DefineAutoSymbolAndVariableOrFunction( GetDefaultPlatform(), new Symbol(DataSymbol, "primary_cache_header", primaryBase), headerType.type); + if (GetFile()->GetFilename().empty()) + { + // We have initialized the view with no backing file. + // We are going to forgo initialization of shared cache controller, as there is no way to populate entries. + // This can occur when downloading shared cache files from a remote project. In the collaboration core it will + // call view init to push metadata about the remote IIRC. + LogInfo("No backing file, skipping shared cache controller initialization..."); + return true; + } + auto sharedCache = SharedCache(GetAddressSize()); { -- cgit v1.3.1