Browse Source

Dispose the grid hack in the correct place.

The grid hack was initiated when attached to the visual tree but the dispose had been placed in `OnDetachedFromLogicalTree` by mistake. Place it in `OnDetachedFromVisualTree`.
pull/4448/head
Steven Kirk 6 years ago
parent
commit
922c46bbc4
  1. 11
      src/Avalonia.Controls/MenuItem.cs

11
src/Avalonia.Controls/MenuItem.cs

@ -323,9 +323,6 @@ namespace Avalonia.Controls
{
Command.CanExecuteChanged -= CanExecuteChanged;
}
_gridHack?.Dispose();
_gridHack = null;
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
@ -351,6 +348,14 @@ namespace Avalonia.Controls
}
}
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
{
base.OnDetachedFromVisualTree(e);
_gridHack?.Dispose();
_gridHack = null;
}
/// <summary>
/// Called when the <see cref="MenuItem"/> is clicked.
/// </summary>

Loading…
Cancel
Save