Ensure that image files aren't left open #3730
Draft
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.
Currently, when core's Image() is given a path, it passes that path on to the backend. We've learned (from a report on Discord) that, at least on Windows, this results in the file being kept open even after the Image is created (presumably by something in Python.NET). This PR is to change the logic so that core handles reading the file's data, then passes that along to the backend. This way we can ensure the file is closed.
I'm uploading this first as just the test, because I'm curious to see which platforms currently suffer from this issue.
Also: this will obsolete the
path
parameter to each backend's Image class. Is that worth a deprecation, since it's internal and version-locked?PR Checklist: