mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
fix: terminate process if service unload fails
This commit is contained in:
parent
880095428c
commit
b80681e3e1
1 changed files with 17 additions and 2 deletions
|
|
@ -156,6 +156,8 @@ public sealed class EntryPoint
|
|||
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
|
||||
TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
|
||||
|
||||
var unloadFailed = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (info.DelayInitializeMs > 0)
|
||||
|
|
@ -180,7 +182,15 @@ public sealed class EntryPoint
|
|||
|
||||
dalamud.WaitForUnload();
|
||||
|
||||
ServiceManager.UnloadAllServices();
|
||||
try
|
||||
{
|
||||
ServiceManager.UnloadAllServices();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Fatal(ex, "Could not unload services.");
|
||||
unloadFailed = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -195,6 +205,11 @@ public sealed class EntryPoint
|
|||
Log.CloseAndFlush();
|
||||
SerilogEventSink.Instance.LogLine -= SerilogOnLogLine;
|
||||
}
|
||||
|
||||
// If we didn't unload services correctly, we need to kill the process.
|
||||
// We will never signal to Framework.
|
||||
if (unloadFailed)
|
||||
Environment.Exit(-1);
|
||||
}
|
||||
|
||||
private static void SerilogOnLogLine(object? sender, (string Line, LogEvent LogEvent) ev)
|
||||
|
|
@ -327,7 +342,7 @@ public sealed class EntryPoint
|
|||
}
|
||||
|
||||
var pluginInfo = string.Empty;
|
||||
var supportText = ", please visit us on Discord for more help.";
|
||||
var supportText = ", please visit us on Discord for more help";
|
||||
try
|
||||
{
|
||||
var pm = Service<PluginManager>.GetNullable();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue