Fixed the issue that crash when close.

This commit is contained in:
2026-03-29 01:13:51 +09:00
parent 3aef53cad9
commit b5d8009bec
12 changed files with 90 additions and 30 deletions

View File

@@ -13,10 +13,10 @@
<langversion>preview</langversion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.2" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.7463" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.260101001" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.5" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.7705" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.260317003" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.2.251219" />
</ItemGroup>

View File

@@ -41,10 +41,6 @@ public class NotificationService : INotificationService
internal void ClearReference()
{
if (_infoBar != null)
{
_infoBar.IsOpen = false;
}
_infoBar = null;
_notificationQueue = null;
}

View File

@@ -62,7 +62,7 @@ public static class TypeCache
return dict;
}
internal static void Init()
internal static void Initialize()
{
// Intentionally left blank.
// This method exists to force the static constructor to run.

View File

@@ -1,6 +1,5 @@
using Ghost.Editor.Core.Utilities;
using Ghost.Editor.Models;
using Ghost.Engine;
using Misaki.HighPerformance.LowLevel.Buffer;
using System.Reflection;
@@ -52,7 +51,7 @@ internal static class ActivationHandler
return arguments;
}
public static async Task HandleAsync(LaunchArguments args)
public static ValueTask HandleAsync(LaunchArguments args)
{
var opts = new AllocationManagerInitOpts
{
@@ -62,16 +61,18 @@ internal static class ActivationHandler
};
AllocationManager.Initialize(opts);
await Task.Run(() =>
{
TypeCache.Init();
App.GetService<EngineCore>();
});
TypeCache.Initialize();
// await ((Core.AssetHandle.AssetService)App.GetService<IAssetService>()).Init();
// TODO: Init other subsystems here.
// await Task.Delay(10000); // Wait 10 seconds to simulate work.
return ValueTask.CompletedTask;
}
public static void Shutdown()
{
AllocationManager.Dispose();
}
}

View File

@@ -144,12 +144,17 @@ public partial class App : Application
Host.StopAsync().GetAwaiter().GetResult();
Host.Dispose();
EditorApplication.Shutdown();
//EditorApplication.Shutdown();
ActivationHandler.Shutdown();
}
catch (Exception ex)
{
Debugger.BreakForUserUnhandledException(ex);
}
finally
{
//Environment.Exit(0);
}
}
private void App_UnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e)

View File

@@ -13,6 +13,7 @@
</PropertyGroup>
<ItemGroup>
<None Remove="View\Controls\Hierarchy.xaml" />
<None Remove="View\Windows\BlankWindow1.xaml" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\SplashScreen.scale-200.png" />
@@ -38,10 +39,10 @@
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.2.251219" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Sizers" Version="8.2.251219" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.TabbedCommandBar" Version="8.2.251219" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.2" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.5" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.2.0" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.7463" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.260101001" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.7705" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.260317003" />
<PackageReference Include="WinUIEx" Version="2.9.0" />
</ItemGroup>
<ItemGroup>
@@ -141,6 +142,9 @@
<None Update="Assets\icon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Page Update="View\Windows\BlankWindow1.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="View\Controls\Hierarchy.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>

View File

@@ -8,12 +8,13 @@
<Setter.Value>
<ControlTemplate TargetType="local:DockGroup">
<Grid>
<TabView x:Name="PART_TabView"
IsAddTabButtonVisible="False"
<TabView
x:Name="PART_TabView"
VerticalAlignment="Stretch"
AllowDrop="True"
CanDragTabs="True"
CanReorderTabs="False"
AllowDrop="True">
</TabView>
IsAddTabButtonVisible="False" />
</Grid>
</ControlTemplate>
</Setter.Value>

View File

@@ -144,6 +144,8 @@
DoubleTapped="PART_FilesView_DoubleTapped"
IsDoubleTapEnabled="True"
ItemsSource="{x:Bind ViewModel.Files, Mode=OneWay}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.HorizontalScrollMode="Disabled"
SelectionChanged="PART_FilesView_SelectionChanged"
SelectionMode="Single">
<ItemsView.ItemTemplate>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<Window
x:Class="Ghost.Editor.View.Windows.BlankWindow1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Ghost.Editor.View.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="BlankWindow1"
mc:Ignorable="d">
<Window.SystemBackdrop>
<MicaBackdrop />
</Window.SystemBackdrop>
<Grid />
</Window>

View File

@@ -0,0 +1,29 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace Ghost.Editor.View.Windows;
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class BlankWindow1 : Window
{
public BlankWindow1()
{
InitializeComponent();
}
}

View File

@@ -64,8 +64,12 @@
</ctc:TabbedCommandBar>
</Grid>
<Grid xmlns:dock="using:Ghost.Editor.View.Controls.Docking" Grid.Row="2">
<dock:DockingLayout x:Name="MainDockingLayout" />
</Grid>
<!-- Editor -->
<Grid Grid.Row="2">
<!--<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
@@ -134,7 +138,7 @@
</TabViewItem>
</ghost:NavigationTabView.TabItems>
</ghost:NavigationTabView>
</Grid>
</Grid>-->
<!-- Status Bar -->
<Grid

View File

@@ -18,7 +18,7 @@ public sealed partial class EngineCore : IDisposable
public JobScheduler JobScheduler => _jobScheduler;
public RenderSystem RenderSystem => _renderSystem;
internal EngineCore()
public EngineCore()
{
_jobScheduler = new JobScheduler(Environment.ProcessorCount - 2); // We -2 here, one for main thread, one for render thread
@@ -35,6 +35,7 @@ public sealed partial class EngineCore : IDisposable
public void Dispose()
{
_renderSystem.Dispose();
_jobScheduler.Dispose();
}
}