fix(dock): ensure callback side-effect cleanup and improve tear-off diagnostics

This commit is contained in:
2026-03-28 17:30:50 +09:00
parent 7ac9a66110
commit 287b3b303f
3 changed files with 37 additions and 14 deletions

View File

@@ -59,8 +59,22 @@ public partial class App : Application
internal static void CreateAndShowDockWindow(object tabContent)
{
var newWindow = new Ghost.Editor.View.Windows.DockWindow(tabContent);
AddSecondaryWindow(newWindow);
newWindow.Activate();
try
{
AddSecondaryWindow(newWindow);
newWindow.Activate();
}
catch (Exception ex)
{
// Cleanup partially created window
if (Current is App app)
{
app._secondaryWindows.Remove(newWindow);
}
newWindow.Close();
Logger.LogError(ex);
throw;
}
}
internal IHost Host