From ea7d3fad26677cf4234aadddc8b80a810458be1c Mon Sep 17 00:00:00 2001 From: Misaki Date: Sat, 28 Mar 2026 17:44:10 +0900 Subject: [PATCH] fix(dock): clean up unused variables and simplify event handling --- src/Editor/Ghost.Editor/App.xaml.cs | 2 +- src/Editor/Ghost.Editor/View/Controls/DockLayout.cs | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Editor/Ghost.Editor/App.xaml.cs b/src/Editor/Ghost.Editor/App.xaml.cs index 083ec71..bc7535c 100644 --- a/src/Editor/Ghost.Editor/App.xaml.cs +++ b/src/Editor/Ghost.Editor/App.xaml.cs @@ -64,7 +64,7 @@ public partial class App : Application AddSecondaryWindow(newWindow); newWindow.Activate(); } - catch (Exception ex) + catch (Exception) { // Cleanup partially created window if (Current is App app) diff --git a/src/Editor/Ghost.Editor/View/Controls/DockLayout.cs b/src/Editor/Ghost.Editor/View/Controls/DockLayout.cs index f22e67e..31391d7 100644 --- a/src/Editor/Ghost.Editor/View/Controls/DockLayout.cs +++ b/src/Editor/Ghost.Editor/View/Controls/DockLayout.cs @@ -434,7 +434,8 @@ public sealed partial class DockLayout : Control // Validate that the item actually belongs to this source node before attempting tear-off if (sourceNode.Items.Contains(args.Item)) { - if (TabTornOff == null) + var handler = TabTornOff; + if (handler == null) { Logger.LogWarning("Tab dropped outside but no TabTornOff subscribers found."); return; @@ -442,12 +443,6 @@ public sealed partial class DockLayout : Control var result = TabTearOffService.TryTearOffTab(sourceNode.Items, args.Item, (tab) => { - var handler = TabTornOff; - if (handler == null) - { - throw new InvalidOperationException("No tear-off handler attached."); - } - // Raise event to let the host handle window creation handler.Invoke(this, new TabTornOffEventArgs(tab, sourceNode)); }, sourceNode);