Browse Source

Fix ImageBrush crash when source bitmap gets disposed (#13506)

pull/13510/head
Nikita Tsukanov 2 years ago
committed by GitHub
parent
commit
e40d5d624c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      src/Avalonia.Base/Media/Imaging/Bitmap.cs

12
src/Avalonia.Base/Media/Imaging/Bitmap.cs

@ -284,6 +284,16 @@ namespace Avalonia.Media.Imaging
return AvaloniaLocator.Current.GetRequiredService<IPlatformRenderInterface>();
}
IRef<IBitmapImpl> IImageBrushSource.Bitmap => PlatformImpl;
IRef<IBitmapImpl>? IImageBrushSource.Bitmap
{
get
{
// TODO12: We should probably make PlatformImpl to be nullable or make it possible to check
// and fix IRef<T> in general (right now Item is not nullable while it internally is)
if (PlatformImpl.Item == null!)
return null;
return PlatformImpl;
}
}
}
}

Loading…
Cancel
Save