fix(wallets): probe synchronously during the offline screenshot sweep

The async probe fills badges/counts a frame after the dialog opens, which the
single-frame screenshot sweep captured before it landed (badges/counts missing).
Run the probe synchronously when App::isScreenshotSweeping(), so the captured
modal-wallets frame is populated; interactive use keeps the detached-thread path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-11 16:03:32 -05:00
parent 171b705429
commit c4f69b5a85

View File

@@ -502,8 +502,9 @@ private:
targets.reserve(s_rows.size()); targets.reserve(s_rows.size());
for (std::size_t i = 0; i < s_rows.size(); ++i) for (std::size_t i = 0; i < s_rows.size(); ++i)
targets.emplace_back(s_rows[i].dir + "/" + s_rows[i].fileName, i); targets.emplace_back(s_rows[i].dir + "/" + s_rows[i].fileName, i);
if (!targets.empty()) {
std::thread([batch, targets]() { auto runProbe = [](std::shared_ptr<ProbeBatch> batch,
std::vector<std::pair<std::string, std::size_t>> targets) {
// Per-file 256 MB (BDB sorts long-keyed mkey/hdchain LATE, so a small cap risks a // Per-file 256 MB (BDB sorts long-keyed mkey/hdchain LATE, so a small cap risks a
// false-negative); a shared budget bounds total I/O, charged by bytes actually read. // false-negative); a shared budget bounds total I/O, charged by bytes actually read.
std::size_t budget = 768u * 1024u * 1024u; std::size_t budget = 768u * 1024u * 1024u;
@@ -528,7 +529,13 @@ private:
std::lock_guard<std::mutex> lk(batch->mtx); std::lock_guard<std::mutex> lk(batch->mtx);
if (t.second < batch->results.size()) batch->results[t.second] = res; if (t.second < batch->results.size()) batch->results[t.second] = res;
} }
}).detach(); };
if (targets.empty()) {
// nothing to probe
} else if (s_app && s_app->isScreenshotSweeping()) {
runProbe(batch, targets); // offline sweep: probe synchronously so the captured frame is populated
} else {
std::thread(runProbe, batch, targets).detach();
} }
} }