Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webp: Dont use using statement for encodedAlphaData #2412

Merged
merged 3 commits into from
Mar 24, 2023
Merged

Conversation

brianpopow
Copy link
Collaborator

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable) Not sure howto provide a test for this issue.

Description

This PR changes the disposing of the encodedAlphaData to be in a try/finally block instead of using statement.
This is related to Issue #2411

It will now be disposed in a try / finally block.
@brianpopow brianpopow linked an issue Mar 24, 2023 that may be closed by this pull request
5 tasks
@brianpopow brianpopow changed the title Dont use using statement for encodedAlphaData Webp: Dont use using statement for encodedAlphaData Mar 24, 2023
alphaData[..alphaDataSize],
this.alphaCompression && alphaCompressionSucceeded);
try
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your going to want to start this try before the if (hasAlpha) line otherwise anything that fails before the WriteEncodedImageToStream line will cause the memory to leak

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, changed with db3d748

@brianpopow brianpopow merged commit 302a23f into main Mar 24, 2023
@brianpopow brianpopow deleted the bp/Issue2411 branch March 24, 2023 21:50
@antonfirsov antonfirsov mentioned this pull request Mar 27, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

System.ExecutionEngineException when trying to save image as webp
2 participants