Fix Refresh crash when no backup folder is available - #11
Open
jpmartins98 wants to merge 1 commit into
Open
Conversation
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
Make Refresh safe when no backup folder is selected, remembered, or automatically discovered.
Problem and root cause
The landing page currently creates a
FunctionWorkereven when there are no roots to scan. Because this zero-work worker can complete immediately and is only retained in a local variable, the operation has a race-prone lifetime and can crash the application when Refresh is clicked in the empty state.Changes
_discover_backup_rows()instead of discovering them again.FunctionWorkeronLandingPageuntil it reports a result or error.Why this PR is needed
Refresh is visible before a backup is selected and must be safe on a clean installation, after removing a backup drive, or on systems where automatic discovery returns nothing. An empty state is normal application state, not an exceptional condition.
Compatibility and risk
Scans with real roots continue through the existing background worker. The synchronous path is used only when there is provably no work. Backup parsing and discovery rules are unchanged.
Validation
AI disclosure
This PR and all changes introduced by it, including implementation, tests, and this description, were generated by OpenAI Codex under the user's direction. The resulting changes were reviewed through source inspection and the validation described above