mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Disable main thread check when framework is shutting down
This commit is contained in:
parent
7a45c0d661
commit
ede502677b
1 changed files with 8 additions and 2 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
using Dalamud.Game;
|
||||||
|
|
||||||
namespace Dalamud.Utility;
|
namespace Dalamud.Utility;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -23,7 +25,9 @@ public static class ThreadSafety
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void AssertMainThread(string? message = null)
|
public static void AssertMainThread(string? message = null)
|
||||||
{
|
{
|
||||||
if (!threadStaticIsMainThread)
|
var isFrameworkUnloading = Service<Framework>.GetNullable()?.IsFrameworkUnloading ?? true;
|
||||||
|
|
||||||
|
if (!threadStaticIsMainThread && !isFrameworkUnloading)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException(message ?? "Not on main thread!");
|
throw new InvalidOperationException(message ?? "Not on main thread!");
|
||||||
}
|
}
|
||||||
|
|
@ -36,7 +40,9 @@ public static class ThreadSafety
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void AssertNotMainThread()
|
public static void AssertNotMainThread()
|
||||||
{
|
{
|
||||||
if (threadStaticIsMainThread)
|
var isFrameworkUnloading = Service<Framework>.GetNullable()?.IsFrameworkUnloading ?? true;
|
||||||
|
|
||||||
|
if (threadStaticIsMainThread && !isFrameworkUnloading)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("On main thread!");
|
throw new InvalidOperationException("On main thread!");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue