Skip to content

Fix seven small bugs I found while reading the code#258

Open
zekovdev wants to merge 7 commits into
Blur009:devfrom
zekovdev:fix/deep-audit-pass2
Open

Fix seven small bugs I found while reading the code#258
zekovdev wants to merge 7 commits into
Blur009:devfrom
zekovdev:fix/deep-audit-pass2

Conversation

@zekovdev

@zekovdev zekovdev commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

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 accepted 7.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

  • Bug fix

Screenshots (if applicable)

Validation

cargo fmt/clippy/test (73/73) and npm lint/tsc/test (9/9) — all passed. My lines Prettier-clean.

Checklist

  • I ran npm run check:all and it passed with no errors
  • I kept the change focused and avoided unrelated refactors
  • I updated related documentation when needed

zekovdev added 7 commits July 5, 2026 06:10
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant