Export image-based: keep the profile's Resolution (fix #12244)#12250
Merged
Conversation
…eopen) Profiles in the "Export to ... (Blu-ray sup)" dialog stored a resolution that was silently lost - and often overwritten - on reopen (#12244). Two defects compounded: 1. LoadProfile matched the resolution combo by Width ONLY, against the static preset list. A profile's custom resolution (e.g. UHD 3840x1920) has no matching preset height, so it snapped to a same-width preset (3840x2160) or, with no width match, to the 1920x1080 default. Font size round-tripped by exact value, so only the resolution appeared to "reset". 2. Initialize force-selected the loaded video's resolution AFTER the profile was applied, so opening the export with a video loaded replaced the profile's resolution with the video's - and, because SaveProfile runs on close, wrote the video's size back into the selected profile, corrupting it. This is what made the reporter's UHD profile show the HD source video's 1920x960. Fix: add EnsureResolutionItem(width, height) that matches on BOTH dimensions and materialises a custom item when the exact size isn't a preset, so any resolution round-trips. LoadProfile uses it; Initialize now only makes the video's resolution available and falls back to it solely when the profile left no valid resolution selected (?? instead of overwrite). Verified via a standalone harness: UHD custom resolution survives reopen with an HD video loaded, is not corrupted on save-on-close, same-width custom heights don't shadow presets, in-session profile switching round-trips, and standard presets plus the video-fallback still work. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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 #12244 — profiles in the "Export to … (Blu-ray sup)" dialog lost (or silently overwrote) their Resolution on reopen, while font size restored fine.
Root cause — two compounding defects
LoadProfilematched resolution by Width only, against presets only. The save path writes bothScreenWidthandScreenHeight, but the load matchedResolutions.FirstOrDefault(r => r.Width == profile.ScreenWidth). A profile's custom resolution (UHD 3840×1920) has no preset with that height, so it snapped to the same-width preset (3840×2160) or, with no width match, to the 1920×1080 default. Font size round-trips by exact value — hence only the resolution seemed to "reset".Initializeforce-selected the loaded video's resolution after the profile was applied.ExportBluRaySuppasses the main window's video in, andInitializeasynchronously setSelectedResolutionto the video's size, overriding the profile. BecauseSaveProfileruns on close, the video's size was then written back into the selected profile — corrupting it. This is what made the reporter's UHD profile display the HD source video's 1920×960.Fix
EnsureResolutionItem(width, height)— matches on both dimensions and materialises a customResolutionItem(just below the "pick from video" entry) when the exact size isn't a preset, so any resolution round-trips.LoadProfileuses it, so custom resolutions restore exactly.Initializenow only makes the video's resolution available in the combo and falls back to it only when the profile left no valid resolution selected (SelectedResolution ??= iteminstead of overwrite). A profile with a resolution always wins; the video can still be picked manually.Verification
Standalone harness reproducing the reported setup (HD 1920×960 + UHD 3840×1920 profiles, presets-only list, a loaded HD video) — 8/8 checks pass:
Built the UI project clean. Not driven through the live GUI, but the affected logic is covered by the harness above.
🤖 Generated with Claude Code