Fix seven small bugs I found while reading the code#258
Open
zekovdev wants to merge 7 commits into
Open
Conversation
trim_webview_processes walks children_of from our own PID with a plain queue and no visited set. th32ParentProcessID in a ToolHelp snapshot can be stale after a parent exits (Windows reuses PIDs), forming a parent-child cycle; the walk then loops forever and grows descendant_pids without bound until the process aborts on allocation failure. This runs on a recurring background thread, so it can take the whole app down. Track visited PIDs and descend into each only once.
ToggleBtn is memoized on value/disabled/disabledReason and ignores onChange, so after switching Click<->Time while the toggle is off (value stays false) it keeps the stale handleToggleChange closure. Clicking it on then enables the wrong limit. Read the current mode from a ref kept up to date in the existing layout effect instead of the render-captured value.
initialize_crashpad called .to_str().unwrap() on the handler and database paths, which panics inside Tauri setup() if %LOCALAPPDATA% contains non-UTF-8 characters. The builder accepts AsRef<Path>, so pass the PathBufs directly.
avg_cpu can arrive as JSON null (serde serializes a non-finite f64 as null) from a corrupt stats.csv. null < 0 is false, so formatCpu fell through to null.toLocaleString() and crashed the app into the error boundary. Guard with Number.isFinite.
normalizeIntegerRaw let decimals and exponents through (7.5, 1e3), so a fractional value reached the Rust u32/i32 settings fields and serde rejected the whole update_settings IPC, silently desyncing the backend. Truncate at the first non-digit.
An out-of-range X/Y (typed into the unbounded input or loaded from a corrupt settings.json) overflows the Rust SequencePoint i32 fields, so serde rejects update_settings and every setting, including the failsafe zones, silently stops syncing to the backend. Clamp x/y like the neighboring clicks field.
Stopping during a process-list pause left paused=true visible to the frontend: the pause loop cleared it but suppressed its status emit once the run was no longer active, and the UI has no status polling, so the title stayed stuck on the paused state. Clear paused in stop_clicker_inner.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Seven small, unrelated fixes, one commit each:
window_lifecycle.rs— the ~30s process-trim walk had no "seen" set; PID reuse can loop the process tree, so it ran forever and allocated until the app crashed. Added a seen-set.LimitsSection.tsx— the cached Limits toggle kept a stale handler after a Click/Time switch, so turning it on enabled the wrong limit. Read the current mode from a ref.crash_handler.rs—.unwrap()on a non-UTF-8%LOCALAPPDATA%path crashed startup. Pass the path directly.GeneralSection.tsx— a null CPU value from a broken stats file crashed the app; now falls back to "N/A".numberInput.ts— integer boxes accepted7.5/1e3, which the backend rejected, silently stopping settings from saving. Whole numbers only now.settingsSchema.ts— an out-of-range sequence X/Y overflowed the backend's i32 and made it reject every setting (incl. failsafe zones). Clamp X/Y.worker.rs— stopping while process-list-paused left the title stuck on "Paused". Clear it on stop.Related issue(s)
N/A
Change type
Screenshots (if applicable)
—
Validation
cargo fmt/clippy/test(73/73) andnpm lint/tsc/test(9/9) — all passed. My lines Prettier-clean.Checklist
npm run check:alland it passed with no errors