fix(desktop): prevent crash when using "Screenshot area picker" shortcut#1697
Open
BenjaVR wants to merge 1 commit intoCapSoftware:mainfrom
Open
fix(desktop): prevent crash when using "Screenshot area picker" shortcut#1697BenjaVR wants to merge 1 commit intoCapSoftware:mainfrom
BenjaVR wants to merge 1 commit intoCapSoftware:mainfrom
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.
Any shortcut assigned to the "Screenshot area picker" setting did not open the area picker and silently failed. This PR fixes this failure and correctly opens the picker again.
Reason was for example
systemAudiodid not have a (default) value when performing this action, so deserialization of the store failed (withundefinedas value). However, withdefaultit now initializes these with a default value.Greptile Summary
This PR fixes a crash/silent failure when triggering the "Screenshot area picker" shortcut by adding
#[serde(default)]toRecordingSettingsStore. The fix ensures that any fields missing from the persisted store JSON (e.g.systemAudio, which was added after some users had already written a store entry) fall back to theirDefaultvalues rather than causing deserialization to fail.Key changes:
defaultto the#[serde(...)]attribute onRecordingSettingsStore, making all fields optional during deserialization (missingboolfields default tofalse, missingOption<T>fields default toNone)Confidence Score: 5/5
falseforsystem_audio,NoneforOptionfields) are semantically appropriate. The fix also improves forward compatibility for any future fields added to the struct.Important Files Changed
defaultto the serde attribute onRecordingSettingsStore, so missing fields (e.g.systemAudio) fall back to theirDefaultvalue instead of causing a deserialization error.Sequence Diagram
sequenceDiagram participant User participant Shortcut as Shortcut Handler participant Store as Tauri Store participant Serde as serde_json participant Picker as Area Picker User->>Shortcut: Press "Screenshot area picker" shortcut Shortcut->>Store: app.store("store").get("recording_settings") Store-->>Serde: JSON value (may be missing fields e.g. systemAudio) Note over Serde: Before fix: Error on missing fields<br/>After fix: Missing fields use Default values Serde-->>Shortcut: Ok(RecordingSettingsStore) with defaults applied Shortcut->>Picker: Open area picker Picker-->>User: Area picker displayedReviews (1): Last reviewed commit: "fix(desktop): prevent crash when using "..." | Re-trigger Greptile
(2/5) Greptile learns from your feedback when you react with thumbs up/down!