From aca7913c9338a865b736a20043d74a3538f2e93e Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 7 Mar 2024 22:14:01 +0100 Subject: [PATCH] Add automatic last dangling separator removal in context menu --- Source/Editor/GUI/ContextMenu/ContextMenu.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Editor/GUI/ContextMenu/ContextMenu.cs b/Source/Editor/GUI/ContextMenu/ContextMenu.cs index 6909d350d..05d62d3f2 100644 --- a/Source/Editor/GUI/ContextMenu/ContextMenu.cs +++ b/Source/Editor/GUI/ContextMenu/ContextMenu.cs @@ -363,8 +363,8 @@ namespace FlaxEditor.GUI.ContextMenu public override void Show(Control parent, Float2 location) { // Remove last separator to make context menu look better - int lastIndex = Children.Count - 1; - if (lastIndex >= 0 && Children[lastIndex] is ContextMenuSeparator separator) + int lastIndex = _panel.Children.Count - 1; + if (lastIndex >= 0 && _panel.Children[lastIndex] is ContextMenuSeparator separator) separator.Dispose(); base.Show(parent, location);