Browse Source

Disable WriteableBitmap re-use in ColorSlider due to crashes

pull/9140/head
robloo 4 years ago
parent
commit
667b02d2c0
  1. 8
      src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs
  2. 1
      src/Avalonia.Controls.ColorPicker/Helpers/ColorPickerHelpers.cs

8
src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs

@ -135,10 +135,16 @@ namespace Avalonia.Controls.Primitives
{
if (_backgroundBitmap != null)
{
// CURRENTLY DISABLED DUE TO INTERMITTENT CRASHES IN SKIA/RENDERER
//
// Re-use the existing WriteableBitmap
// This assumes the height, width and byte counts are the same and must be set to null
// elsewhere if that assumption is ever not true.
ColorPickerHelpers.UpdateBitmapFromPixelData(_backgroundBitmap, bgraPixelData);
// ColorPickerHelpers.UpdateBitmapFromPixelData(_backgroundBitmap, bgraPixelData);
// ALSO DISABLED DISPOSE DUE TO INTERMITTENT CRASHES
//_backgroundBitmap?.Dispose();
_backgroundBitmap = ColorPickerHelpers.CreateBitmapFromPixelData(bgraPixelData, pixelWidth, pixelHeight);
}
else
{

1
src/Avalonia.Controls.ColorPicker/Helpers/ColorPickerHelpers.cs

@ -627,6 +627,7 @@ namespace Avalonia.Controls.Primitives
/// <summary>
/// Updates the given <see cref="WriteableBitmap"/> with new, raw BGRA pre-multiplied alpha pixel data.
/// WARNING: THIS METHOD IS CURRENTLY PROVIDED AS REFERENCE BUT CAUSES INTERMITTENT CRASHES IF USED.
/// WARNING: The bitmap's width, height and byte count MUST not have changed and MUST be enforced externally.
/// </summary>
/// <param name="bitmap">The existing <see cref="WriteableBitmap"/> to update.</param>

Loading…
Cancel
Save