mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
pm: make sure that we don't stay on framework thread when loading and unloading
Without ConfigureAwait(false), all of the continuations below the await will be blocking the main thread
This commit is contained in:
parent
d0bc415fd5
commit
34a51d0119
1 changed files with 5 additions and 3 deletions
|
|
@ -419,10 +419,12 @@ internal class LocalPlugin : IDisposable
|
|||
{
|
||||
if (this.manifest.LoadSync && this.manifest.LoadRequiredState is 0 or 1)
|
||||
{
|
||||
this.instance = await framework.RunOnFrameworkThread(
|
||||
var newInstance = await framework.RunOnFrameworkThread(
|
||||
() => this.ServiceScope.CreateAsync(
|
||||
this.pluginType!,
|
||||
this.DalamudInterface!)) as IDalamudPlugin;
|
||||
this.DalamudInterface!)).ConfigureAwait(false);
|
||||
|
||||
this.instance = newInstance as IDalamudPlugin;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -512,7 +514,7 @@ internal class LocalPlugin : IDisposable
|
|||
if (this.manifest.CanUnloadAsync || framework == null)
|
||||
this.instance?.Dispose();
|
||||
else
|
||||
await framework.RunOnFrameworkThread(() => this.instance?.Dispose());
|
||||
await framework.RunOnFrameworkThread(() => this.instance?.Dispose()).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue