Fix unhandled IOException when saving file in use by another process#161
Open
Slashxdd wants to merge 1 commit intoModuleArt:feature/new-webp-decoderfrom
Open
Fix unhandled IOException when saving file in use by another process#161Slashxdd wants to merge 1 commit intoModuleArt:feature/new-webp-decoderfrom
Slashxdd wants to merge 1 commit intoModuleArt:feature/new-webp-decoderfrom
Conversation
Resolves ModuleArt#106: saving over a file locked by another app threw an unhandled IOException crashing the application. Changes: - SaveFile now returns bool (true = success, false = failure) - File I/O wrapped in try/catch IOException; shows "Not saved: <reason>" via showSuggestion on failure - dispose block moved to AFTER successful save so that if Save As fails, the original image remains visible and unsaved changes are preserved - saveBtn_Click and saveAsButton_Click only call setImageChanged(false) and reload on successful save Co-Authored-By: Claude Sonnet 4.6 <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 #106
Problem
Saving (Ctrl+S or Save As) a file that is locked by another process throws an unhandled
System.IO.IOExceptionand crashes the app. TheFileStreamconstructor on line 2483 had no exception handling.Additionally, in the Save As path (
dispose = true),originalImagewas disposed before the save attempt — meaning a failed save would leave the user with a blank screen and their edits permanently lost.Changes
SaveFilenow returnsbool—trueon success,falseon failure.File I/O wrapped in
try/catch IOException— on failure, shows a friendly status bar message ("Not saved: <reason>") instead of crashing.disposeblock moved to after a successful save — if Save As fails, the original image stays intact and the "unsaved changes" flag is preserved.Callers updated —
saveBtn_ClickandsaveAsButton_Clickonly callsetImageChanged(false)/OpenFile()whenSaveFilereturnstrue.