Correctly free resources in Uno Platform's SKXamlCanvas#3431
Open
MartinZikmund wants to merge 3 commits intomono:mainfrom
Open
Correctly free resources in Uno Platform's SKXamlCanvas#3431MartinZikmund wants to merge 3 commits intomono:mainfrom
MartinZikmund wants to merge 3 commits intomono:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes resource lifetime handling in Uno Platform’s SKXamlCanvas so reallocating the pixel buffer (eg. during resize) no longer invalidates the WriteableBitmap, preventing NullReferenceExceptions and separating pixel/bitmap cleanup.
Changes:
- Update
DoUnloaded()to free both theWriteableBitmapand the pinned pixel buffer. - Rework
CreateBitmap()to (re)allocate/freepixelsindependently ofbitmap, avoiding resize-time NREs. - Split cleanup into
FreePixels()andFreeBitmap().
source/SkiaSharp.Views.Uno/SkiaSharp.Views.Uno.WinUI.Skia/SKXamlCanvas.Skia.cs
Outdated
Show resolved
Hide resolved
source/SkiaSharp.Views.Uno/SkiaSharp.Views.Uno.WinUI.Skia/SKXamlCanvas.Skia.cs
Outdated
Show resolved
Hide resolved
3313690 to
0ac9935
Compare
Contributor
|
/azp run |
|
No pipelines are associated with this pull request. |
mattleibow
added a commit
that referenced
this pull request
Feb 13, 2026
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.
Description of Change
Freeing
pixelsfield in Uno Platform'sSKXamlCanvasshould not freebitmapand vice versa.Bugs Fixed
SKXamlCanvas#3430API Changes
None.
Behavioral Changes
Code no longer throws in case the canvas size changes.
Required skia PR
None.
PR Checklist