summaryrefslogtreecommitdiff
path: root/view/sharedcache
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-06 18:03:26 -0400
committerMason Reed <mason@vector35.com>2025-05-06 18:03:26 -0400
commitd7e587991b96457d3887c136799ecb906f1336f4 (patch)
tree4ea9264d0d82023bfcf9dab3ac7db3547dfb4700 /view/sharedcache
parent9bd77eca3d5a0fea7b57af6252d85ab4ce4c506d (diff)
[SharedCache]"Fix" possible deadlock when loading images from the UI
This disables the filter for already added images, there is another check when we go to apply so that it fails early but the real issue is the fact this happened at all. Within the Objective-C processor there is a call to `BeginUndoActions` which calls `ExecuteOnMainThreadAndWait`, while the objective-c processor is holding the lock to the controller. To fix this we really need to make the undo action system not call `ExecuteOnMainThreadAndWait` which is deadlock city, to do that really the only solution is to make the `UndoBuffer` thread-safe and remove the calls to execute undo related stuff on the main thread, this will make it so that when a call to `BeginUndoActions` there is no requirement to wait on pending undo actions as they are all submitted immediately.
Diffstat (limited to 'view/sharedcache')
-rw-r--r--view/sharedcache/ui/dsctriage.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/view/sharedcache/ui/dsctriage.cpp b/view/sharedcache/ui/dsctriage.cpp
index 5a4536c6..b367b809 100644
--- a/view/sharedcache/ui/dsctriage.cpp
+++ b/view/sharedcache/ui/dsctriage.cpp
@@ -74,10 +74,17 @@ DSCTriageView::~DSCTriageView()
void DSCTriageView::loadImagesWithAddr(const std::vector<uint64_t>& addresses, bool includeDependencies) {
- auto controller = SharedCacheController::GetController(*this->m_data);
+ auto controller = SharedCacheController::GetController(*m_data);
if (!controller)
return;
+ // TODO: NOTE ABOUT `IsImageLoaded` BEING COMMENTED OUT. PLEASE READ.
+ // TODO: Because commiting undo actions will use main thread to synchronize we must not be holding any locks
+ // TODO: This can really only ever be removed if:
+ // TODO: 1. we can set a user function type without creating an undo action, basically like the rest of shared cache
+ // TODo: use an auto function or some hack to get the user function but without the undo action.
+ // TODO: 2. we can use the undo buffer from any thread and not just the main thread
+ // TODO: I have exhausted all other options, this is a serious issue we should address soon.
typedef std::vector<CacheImage> ImageList;
ImageList images = {};
for (const uint64_t& addr : addresses)
@@ -86,8 +93,8 @@ void DSCTriageView::loadImagesWithAddr(const std::vector<uint64_t>& addresses, b
if (image.has_value())
{
// Only try to load if we have not already.
- if (!controller->IsImageLoaded(*image))
- images.emplace_back(*image);
+ // if (!controller->IsImageLoaded(*image))
+ images.emplace_back(*image);
// TODO: We currently only add direct dependencies, may want to make the depth configurable?
if (includeDependencies)
@@ -96,7 +103,7 @@ void DSCTriageView::loadImagesWithAddr(const std::vector<uint64_t>& addresses, b
for (const auto& depName : dependencies)
{
auto depImage = controller->GetImageWithName(depName);
- if (depImage.has_value() && !controller->IsImageLoaded(*depImage))
+ if (depImage.has_value()/* && !controller->IsImageLoaded(*depImage) */)
{
images.emplace_back(*depImage);
}