From 67260cc6f00276498250f07a6c69f2d69d0f6c67 Mon Sep 17 00:00:00 2001 From: DanS Date: Fri, 9 Oct 2026 21:09:48 -0500 Subject: [PATCH] fix(mining): disable the thread stepper while a benchmark runs The thread grid is inert during a benchmark, but the -/+ buttons and the count field still took input: a click changed the shown and saved count while the benchmark owned the miner's (before the previous commit it also restarted xmrig at that count and spoiled the measurement). The buttons and the field are now disabled until the benchmark ends. Co-Authored-By: Claude Opus 5.5 --- src/ui/windows/mining_controls.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ui/windows/mining_controls.cpp b/src/ui/windows/mining_controls.cpp index 6b266c3..f358881 100644 --- a/src/ui/windows/mining_controls.cpp +++ b/src/ui/windows/mining_controls.cpp @@ -143,6 +143,7 @@ void RenderMiningControls(App* app, const WalletState& state, const MiningInfo& auto applyThreads = [&](int tc) { tc = std::clamp(tc, 1, max_threads); if (tc == s_selected_threads) return; + if (s_benchmark.active()) return; // the benchmark owns the thread count while it runs (as the grid) s_selected_threads = tc; // shown at once; the App applies it ~0.5 s after the last change app->selectMiningThreads(tc); }; @@ -189,7 +190,7 @@ void RenderMiningControls(App* app, const WalletState& state, const MiningInfo& // "-" button (disabled at 1 thread) if (rectStepBtn("##ThreadMinus", ICON_MD_REMOVE, sx, TR("mining_threads_minus_tooltip"), - s_selected_threads <= 1)) + s_selected_threads <= 1 || s_benchmark.active())) applyThreads(s_selected_threads - 1); sx += sideW + g; @@ -202,15 +203,18 @@ void RenderMiningControls(App* app, const WalletState& state, const MiningInfo& ImGui::SetCursorScreenPos(ImVec2(sx, sy)); ImGui::SetNextItemWidth(fieldW); int tc = s_selected_threads; + const bool benchLocked = s_benchmark.active(); // read-only while the benchmark runs (as -/+) + ImGui::BeginDisabled(benchLocked); if (ImGui::InputInt("##ThreadCountInput", &tc, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue)) applyThreads(tc); if (ImGui::IsItemHovered()) material::Tooltip("%s", TR("mining_threads_input_tooltip")); + ImGui::EndDisabled(); ImGui::PopStyleVar(); sx += fieldW + g; // "+" button (disabled at max_threads) if (rectStepBtn("##ThreadPlus", ICON_MD_ADD, sx, TR("mining_threads_plus_tooltip"), - s_selected_threads >= max_threads)) + s_selected_threads >= max_threads || s_benchmark.active())) applyThreads(s_selected_threads + 1); ImGui::SetCursorScreenPos(savedCur);