From 253fd4ad2d8095cc3c640c99d75ab3fd1cb7282e Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sun, 12 Oct 2025 22:48:41 -0400 Subject: [WARP] Fix misc sidebar navigation / focus event bugs - Fixed crash related to pending fetch callback for deleted view frame - Fixed focus not being kept for tables in the sidebar, as well as focus in general - Made matched function list navigation require a double click, to fix accidental navigation to other functions --- plugins/warp/ui/shared/fetcher.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'plugins/warp/ui/shared/fetcher.cpp') diff --git a/plugins/warp/ui/shared/fetcher.cpp b/plugins/warp/ui/shared/fetcher.cpp index 1a262878..403d7cdb 100644 --- a/plugins/warp/ui/shared/fetcher.cpp +++ b/plugins/warp/ui/shared/fetcher.cpp @@ -24,14 +24,20 @@ std::vector WarpFetcher::FlushPendingFunctions() void WarpFetcher::ExecuteCompletionCallback() { - BinaryNinja::ExecuteOnMainThread([this]() { - // TODO: Holding the mutex here is dangerous! + std::vector> callbacks; + { std::lock_guard lock(m_requestMutex); - m_completionCallbacks.erase( - std::ranges::remove_if(m_completionCallbacks, [](const auto& cb) { return cb() == RemoveCallback; }) - .begin(), - m_completionCallbacks.end()); - }); + callbacks.insert(callbacks.end(), m_completionCallbacks.begin(), m_completionCallbacks.end()); + } + + std::vector toRemove = {}; + for (auto& [id, cb] : callbacks) + if (cb() == RemoveCallback) + toRemove.push_back(id); + + std::lock_guard lock(m_requestMutex); + for (auto id : toRemove) + m_completionCallbacks.erase(id); } std::shared_ptr WarpFetcher::Global() -- cgit v1.3.1