Repository navigation
Avoid invalid subtitle add/remove paths near project end - #1916
Merged
Merged
Conversation
Co-authored-by: ddennedy <1146683+ddennedy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix crash due to access violation when adding subtitles
Avoid invalid subtitle add/remove paths near project end
Sep 21, 2026
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The reviewed changes address the identified subtitle-track state and bounds issues.
Review effort: Lite
Findings: None
What changed in this PR
Prevents invalid subtitle-track mutations when adding subtitles near the project end and safely handles invalid track removal.
Changes:
- Defers track creation until subtitle insertion is valid.
- Returns immediately for invalid subtitle-track indices.
| File | Description |
|---|---|
src/models/subtitlesmodel.cpp |
Stops invalid track removal before model/container access. |
src/docks/subtitlesdock.cpp |
Validates available space before creating a subtitle track. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ddennedy
approved these changes
Sep 22, 2026
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.
Repeated Add Subtitle attempts near the end of the project could leave behind an empty subtitle track after the action was rejected for insufficient space, and subtitle track removal still executed after detecting an invalid index. This change makes rejected adds a true no-op and hardens track removal against out-of-range access.
Add Subtitle no longer creates tracks on rejection
SubtitlesDock::onAddRequested()now checks timing constraints before callingensureTrackExists()when no subtitle track exists."Not enough space to add subtitle."actions no longer mutate subtitle-track state.Existing-track behavior stays intact
Invalid subtitle track removal now exits immediately
SubtitlesModel::doRemoveTrack()now returns after logging an invalid index instead of falling through intobeginRemoveRows()/ container removal.