-
Notifications
You must be signed in to change notification settings - Fork 596
Open
Labels
area/SkiaSharpIssues that relate to the C# binding of SkiaSharp.Issues that relate to the C# binding of SkiaSharp.backend/Androidbackend/Metalos/Androidos/Windows-ClassicIssues running on Microsoft Windows using Win32 APIs (Windows.Forms or WPF)Issues running on Microsoft Windows using Win32 APIs (Windows.Forms or WPF)tenet/reliabilityIssues relating to crashes or unexpected behaviorsIssues relating to crashes or unexpected behaviorstype/bug
Description
Description
I think the bug is in ToHarfBuzzBlob() extension - it doesn't dispose SKStreamAsset in all paths.
Code
It seems that this code leaks SKStreamAssets even if properly disposed:
{
public SKPaint Paint { get; set; }
public SKShaper Shaper { get; set; }
private bool disposedValue;
public TextSegmentShaper(SKTypeface typeface, SKPaint fromPaint)
{
Paint = new SKPaint()
{
Style = fromPaint.Style,
IsAntialias = fromPaint.IsAntialias,
Color = fromPaint.Color,
Typeface = typeface,
TextSize = fromPaint.TextSize,
TextAlign = fromPaint.TextAlign,
SubpixelText = fromPaint.SubpixelText,
};
Shaper = new SKShaper(typeface);
}
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
Paint?.Dispose();
Shaper?.Dispose();
Paint = null;
Shaper = null;
disposedValue = true;
}
}```
### Expected Behavior
_No response_
### Actual Behavior
_No response_
### Version of SkiaSharp
3.116.0 (Current)
### Last Known Good Version of SkiaSharp
Other (Please indicate in the description)
### IDE / Editor
Visual Studio (Windows)
### Platform / Operating System
Windows
### Platform / Operating System Version
First observed bug on Android, but seems to be a problem also on Windows.
### Devices
_No response_
### Relevant Screenshots
_No response_
### Relevant Log Output
```shell
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
area/SkiaSharpIssues that relate to the C# binding of SkiaSharp.Issues that relate to the C# binding of SkiaSharp.backend/Androidbackend/Metalos/Androidos/Windows-ClassicIssues running on Microsoft Windows using Win32 APIs (Windows.Forms or WPF)Issues running on Microsoft Windows using Win32 APIs (Windows.Forms or WPF)tenet/reliabilityIssues relating to crashes or unexpected behaviorsIssues relating to crashes or unexpected behaviorstype/bug
Type
Projects
Status
New