An open-source System.Drawing.Common replacement for .NET 5 and above on all platforms. Bringing together System.Drawing, Maui, and ImageSharp's Bitmap, Image, Font, and Shape types via an agnostic free NuGet package.
Other
114
stars
18
forks
source link
Fix null reference exception in AnyBitmap.Dispose method #54
Fix null reference exception in AnyBitmap.Dispose method
Description
This PR adds a null check for AnyBitmap.Image private property in AnyBitmap.Dispose method before calling Image.Dispose().
I've also taken this opportunity to perform a code cleanup in AnyBitmap class, to make it slightly more readable. Still needs
work, particularly in naming conventions department (method parameters are in PascalCase which creates lots of confusion).
Type of change
[X] π Bug fix (non-breaking change which fixes an issue)
[ ] β¨ New feature (non-breaking change which adds functionality)
[ ] π₯ Breaking change (fix or feature that would cause existing functionality to not work as expected)
[X] ποΈ Internal/structural update (non-breaking change that improves code quality, organization, or performance)
[ ] π This change requires a documentation update
[ ] π DevOps build chain modification for release
[ ] π€ DevOps build chain modification for CI
How Has This Been Tested?
100% of existing tests pass locally
Checklist:
[X] My code follows the style guidelines of this project
[X] I have performed a self-review of my own code
[ ] I have commented my code, particularly in hard-to-understand areas
[ ] I have made corresponding changes to the documentation
[X] My changes generate no new warnings
[ ] I have added tests that prove my fix is effective or that my feature works
[X] New and existing unit tests pass locally with my changes
[X] I have successfully run all unit tests on Windows
[X] I have successfully run all unit tests on Linux
Additional Context
Hard to design unit tests for the issue being tested, too tight race condition fails inside of the Image object.
Fix null reference exception in AnyBitmap.Dispose method
Description
This PR adds a null check for AnyBitmap.Image private property in AnyBitmap.Dispose method before calling Image.Dispose(). I've also taken this opportunity to perform a code cleanup in AnyBitmap class, to make it slightly more readable. Still needs work, particularly in naming conventions department (method parameters are in PascalCase which creates lots of confusion).
Type of change
How Has This Been Tested?
100% of existing tests pass locally
Checklist:
Additional Context
Hard to design unit tests for the issue being tested, too tight race condition fails inside of the Image object.