From c77592d4792114558ca76828000796a050cec9af Mon Sep 17 00:00:00 2001 From: Misaki Date: Sat, 28 Mar 2026 17:38:07 +0900 Subject: [PATCH] fix(dock): fix build break and clean up logging/event patterns --- src/Editor/Ghost.Editor/App.xaml.cs | 1 - src/Editor/Ghost.Editor/View/Controls/DockLayout.cs | 8 +++++++- .../Ghost.Editor/View/Windows/EngineEditorWindow.xaml.cs | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Editor/Ghost.Editor/App.xaml.cs b/src/Editor/Ghost.Editor/App.xaml.cs index be02cd9..083ec71 100644 --- a/src/Editor/Ghost.Editor/App.xaml.cs +++ b/src/Editor/Ghost.Editor/App.xaml.cs @@ -72,7 +72,6 @@ public partial class App : Application app._secondaryWindows.Remove(newWindow); } newWindow.Close(); - Logger.LogError(ex); throw; } } diff --git a/src/Editor/Ghost.Editor/View/Controls/DockLayout.cs b/src/Editor/Ghost.Editor/View/Controls/DockLayout.cs index 8375acf..f22e67e 100644 --- a/src/Editor/Ghost.Editor/View/Controls/DockLayout.cs +++ b/src/Editor/Ghost.Editor/View/Controls/DockLayout.cs @@ -442,8 +442,14 @@ 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 - TabTornOff.Invoke(this, new TabTornOffEventArgs(tab, sourceNode)); + handler.Invoke(this, new TabTornOffEventArgs(tab, sourceNode)); }, sourceNode); if (result.IsSuccess) diff --git a/src/Editor/Ghost.Editor/View/Windows/EngineEditorWindow.xaml.cs b/src/Editor/Ghost.Editor/View/Windows/EngineEditorWindow.xaml.cs index d613507..c79b7f3 100644 --- a/src/Editor/Ghost.Editor/View/Windows/EngineEditorWindow.xaml.cs +++ b/src/Editor/Ghost.Editor/View/Windows/EngineEditorWindow.xaml.cs @@ -5,6 +5,7 @@ using Ghost.Editor.Core.Services; using Ghost.Editor.Core.Controls.Internal.Docking; using Ghost.Editor.View.Controls; using Ghost.Editor.ViewModels.Windows; +using Microsoft.UI.Xaml; using Windows.ApplicationModel; using WinUIEx;