diff --git a/src/Editor/Ghost.Editor/ActivationHandler.cs b/src/Editor/Ghost.Editor/ActivationHandler.cs index 5e1ae47..c3d019f 100644 --- a/src/Editor/Ghost.Editor/ActivationHandler.cs +++ b/src/Editor/Ghost.Editor/ActivationHandler.cs @@ -1,5 +1,6 @@ using Ghost.Editor.Core.Utilities; using Ghost.Editor.Models; +using Ghost.Engine; using Misaki.HighPerformance.LowLevel.Buffer; using System.Reflection; @@ -62,11 +63,8 @@ internal static class ActivationHandler AllocationManager.Initialize(opts); TypeCache.Initialize(); - - // await ((Core.AssetHandle.AssetService)App.GetService()).Init(); - - // TODO: Init other subsystems here. - // await Task.Delay(10000); // Wait 10 seconds to simulate work. + + //App.GetService(); return ValueTask.CompletedTask; } diff --git a/src/Editor/Ghost.Editor/App.xaml.cs b/src/Editor/Ghost.Editor/App.xaml.cs index 87a6bad..d1f6a1b 100644 --- a/src/Editor/Ghost.Editor/App.xaml.cs +++ b/src/Editor/Ghost.Editor/App.xaml.cs @@ -151,7 +151,7 @@ public partial class App : Application Host.StopAsync().GetAwaiter().GetResult(); Host.Dispose(); - //EditorApplication.Shutdown(); + EditorApplication.Shutdown(); ActivationHandler.Shutdown(); } catch (Exception ex) diff --git a/src/Editor/Ghost.Editor/Utilities/Converters/GetDirectoryNameConverter .cs b/src/Editor/Ghost.Editor/Utilities/Converters/GetDirectoryNameConverter .cs index 9606e60..0d69fa5 100644 --- a/src/Editor/Ghost.Editor/Utilities/Converters/GetDirectoryNameConverter .cs +++ b/src/Editor/Ghost.Editor/Utilities/Converters/GetDirectoryNameConverter .cs @@ -6,7 +6,7 @@ public partial class GetDirectoryNameConverter : IValueConverter { public object? Convert(object value, Type targetType, object parameter, string language) { - return value is string path ? System.IO.Path.GetDirectoryName(path) : null; + return value is string path ? Path.GetDirectoryName(path) : null; } public object? ConvertBack(object value, Type targetType, object parameter, string language) diff --git a/src/Editor/Ghost.Editor/View/Controls/Docking/FloatingWindow.cs b/src/Editor/Ghost.Editor/View/Controls/Docking/FloatingWindow.cs index f22cb6e..0a1f796 100644 --- a/src/Editor/Ghost.Editor/View/Controls/Docking/FloatingWindow.cs +++ b/src/Editor/Ghost.Editor/View/Controls/Docking/FloatingWindow.cs @@ -7,6 +7,8 @@ namespace Ghost.Editor.View.Controls.Docking; /// public class FloatingWindow : Window { + private readonly DockingLayout _layout; + /// /// Initializes a new instance of the class with the specified document. /// @@ -15,16 +17,26 @@ public class FloatingWindow : Window { ArgumentNullException.ThrowIfNull(document); - var layout = new DockingLayout(); + _layout = new DockingLayout(); var group = new DockGroup(); group.AddChild(document); - layout.RootModule = group; - layout.LayoutEmpty += (s, e) => Close(); + _layout.RootModule = group; + _layout.LayoutEmpty += (s, e) => Close(); - Content = layout; + Content = _layout; // Basic window setup AppWindow.Resize(new global::Windows.Graphics.SizeInt32(800, 600)); + + // When the user manually closes the window, ensure we clean up the documents inside + this.Closed += FloatingWindow_Closed; + } + + private void FloatingWindow_Closed(object sender, WindowEventArgs args) + { + // Force cleanup of the visual tree so we don't leak anything from this window + _layout.RootModule = null; + Content = null; } } diff --git a/src/Editor/Ghost.Editor/View/Controls/ProjectBrowser.xaml b/src/Editor/Ghost.Editor/View/Controls/ProjectBrowser.xaml index 8bc1a27..e77b5bb 100644 --- a/src/Editor/Ghost.Editor/View/Controls/ProjectBrowser.xaml +++ b/src/Editor/Ghost.Editor/View/Controls/ProjectBrowser.xaml @@ -17,7 +17,7 @@ - + @@ -137,19 +137,20 @@ --> - - + - - - - - + + - - + +