AvaloniaUI/Avalonia

CaptureRenderedFrame and random segmentation faults

flucas1 opened this issue · 2 comments

Describe the bug

When using avalonia headless, skia and CaptureRenderedFrame I get random segmentations faults from libSkiaSharp.so.

It is not easy to reproduce. With WSL it is not happening. But it happes in arm64 and in amd64.
Sometimes happens after saving 20 images, others after 200;

However if the resulting WriteableBitmap? is disposed after the .Save, the problem disappears.

I would suggest updating the https://docs.avaloniaui.net/docs/concepts/headless/ to emphasize that the WriteableBitmap? must be disposed. Although probably the issue is something within the skia low level code.

To Reproduce

/

Expected behavior

No response

Avalonia version

newest

OS

Linux

Additional context

No response

Please, collect both native and managed stack traces by running your app with LLDB and .NET extensions installed.

the core dumps are from the internals of skia library.
What I requested is to document in the examples better WriteableBitmap implements IDisposable and needs to be Disposed