From e1b164fa2bd10d5662c65ed930416d2f911c12e1 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 1 Apr 2025 01:03:56 -0400 Subject: [SharedCache] Fix some bugs --- view/sharedcache/core/SharedCacheController.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'view/sharedcache/core/SharedCacheController.h') diff --git a/view/sharedcache/core/SharedCacheController.h b/view/sharedcache/core/SharedCacheController.h index 354762eb..3b92f198 100644 --- a/view/sharedcache/core/SharedCacheController.h +++ b/view/sharedcache/core/SharedCacheController.h @@ -18,8 +18,11 @@ namespace BinaryNinja::DSC { { IMPLEMENT_DSC_API_OBJECT(BNSharedCacheController); Ref m_logger; - SharedCache m_cache; + + // Locks on load attempts (region or image). + std::shared_mutex m_loadMutex; + // Store the open images. // Things other than the cache here will be serialized. std::unordered_set m_loadedRegions; @@ -49,13 +52,13 @@ namespace BinaryNinja::DSC { bool ApplyRegion(BinaryView& view, const CacheRegion& region); - bool IsRegionLoaded(const CacheRegion& region) const; + bool IsRegionLoaded(const CacheRegion& region); // Loads the relevant image info into the view. This does not update analysis so if you // call this make sure at some point you update analysis and likely with linear sweep. bool ApplyImage(BinaryView& view, const CacheImage& image); - bool IsImageLoaded(const CacheImage& image) const; + bool IsImageLoaded(const CacheImage& image); // Get the metadata for saving the state of the shared cache. Ref GetMetadata() const; -- cgit v1.3.1