fix: prevent video corruption from rapid hide/unhide clicks#986
Open
Ahmed-Hekal-01 wants to merge 4 commits intoFossifyOrg:mainfrom
Open
fix: prevent video corruption from rapid hide/unhide clicks#986Ahmed-Hekal-01 wants to merge 4 commits intoFossifyOrg:mainfrom
Ahmed-Hekal-01 wants to merge 4 commits intoFossifyOrg:mainfrom
Conversation
Fixes critical race condition when clicking hide button 2 times quickly. Previously, clicking hide/unhide twice in quick succession would start two concurrent file rename operations, causing file corruption (size becomes 0, duration 00:00, unsupported format error). Changes: - Add mIsTogglingVisibility flag to track ongoing visibility toggle operations - Check flag in click listener to prevent concurrent operations - Clear flag in callback when operation completes This ensures only one hide/unhide operation runs at a time, preventing the race condition that corrupted video files. Tested on Samsung A24, Android 16.
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.
Fixes critical race condition when clicking hide button 2 times quickly.
Changes:
This ensures only one hide/unhide operation runs at a time, preventing the race condition that corrupted video files.
Tested on Samsung A24, Android 16.
Type of change(s)
What changed and why
Tests performed
Before & after preview
Before: Clicking hide button twice quickly corrupts the video file
Video shows: 0 bytes size, 00:00 duration, "unsupported format" error
After: Multiple clicks are safely ignored while operation is in progress, file remains intact
Closes the following issue(s)
N/A - Critical production bug fix (allowed without prior issue per contribution guidelines)
Checklist
CHANGELOG.md(if applicable).