Open
Description
Describe the bug
I am investigating app crash because of AccessViolationException:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Stack:
at SkiaSharp.SkiaApi.<gr_direct_context_flush_and_submit>g__{}PInvoke|27_0(IntPtr, SByte)
at SkiaSharp.SkiaApi.<gr_direct_context_flush_and_submit>g{}{}PInvoke|27_0(IntPtr, SByte)
at Avalonia.Skia.SurfaceRenderTarget.Blit(Avalonia.Platform.IDrawingContextImpl)
at Avalonia.Rendering.Composition.Server.ServerCompositionTarget.Render()
at Avalonia.Rendering.Composition.Server.ServerCompositor.RenderCore(Boolean)
there is a problem in FboSkiaSurface
constructor I guess:
Avalonia/src/Skia/Avalonia.Skia/Gpu/OpenGl/FboSkiaSurface.cs
Lines 91 to 96 in 64ab38f
Since GRBackendRenderTarget
has a finalizer and calls gr_backendrendertarget_delete
in its Dispose
method, it will be invoked as soon as the target is garbage collected (and it will be, because SKSurface doesn't hold a reference to the target).
I am not sure but running such code from finalizer (separate thread) may crash app
To Reproduce
I don't have any repro now
Expected behavior
No response
Avalonia version
11.3.0
OS
Windows
Additional context
No response