fix crashing and such

This commit is contained in:
rootdarkarchon
2023-02-27 12:05:53 +01:00
parent 912d0bd800
commit a37281b719
4 changed files with 16 additions and 21 deletions

View File

@@ -254,11 +254,13 @@ public class DalamudUtil : IDisposable
public async Task RunOnFrameworkThread(Action act)
{
_logger.LogTrace("Running Action on framework thread: {act}", act);
await _framework.RunOnFrameworkThread(act).ConfigureAwait(false);
}
public async Task<T> RunOnFrameworkThread<T>(Func<T> func)
{
_logger.LogTrace("Running Func on framework thread: {func}", func);
return await _framework.RunOnFrameworkThread(func).ConfigureAwait(false);
}
@@ -275,11 +277,11 @@ public class DalamudUtil : IDisposable
// ReSharper disable once LoopVariableIsNeverChangedInsideLoop
while ((!ct?.IsCancellationRequested ?? true)
&& curWaitTime < timeOut
&& await handler.IsBeingDrawn().ConfigureAwait(false)) // 0b100000000000 is "still rendering" or something
&& await handler.IsBeingDrawnRunOnFramework().ConfigureAwait(true)) // 0b100000000000 is "still rendering" or something
{
logger.LogTrace($"[{redrawId}] Waiting for {handler} to finish drawing");
curWaitTime += tick;
Thread.Sleep(tick);
await Task.Delay(tick).ConfigureAwait(true);
}
logger.LogTrace($"[{redrawId}] Finished drawing after {curWaitTime}ms");