mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-31 21:03:43 +01:00
Merge pull request #1966 from Soreepeong/fix/servicescope
ServiceScope fixes
This commit is contained in:
commit
8c593bc31d
5 changed files with 165 additions and 166 deletions
|
|
@ -417,24 +417,16 @@ internal class LocalPlugin : IDisposable
|
|||
|
||||
try
|
||||
{
|
||||
if (this.manifest.LoadSync && this.manifest.LoadRequiredState is 0 or 1)
|
||||
{
|
||||
var newInstance = await framework.RunOnFrameworkThread(
|
||||
() => this.ServiceScope.CreateAsync(
|
||||
this.pluginType!,
|
||||
this.DalamudInterface!)).ConfigureAwait(false);
|
||||
|
||||
this.instance = newInstance as IDalamudPlugin;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.instance =
|
||||
await this.ServiceScope.CreateAsync(this.pluginType!, this.DalamudInterface!) as IDalamudPlugin;
|
||||
}
|
||||
var forceFrameworkThread = this.manifest.LoadSync && this.manifest.LoadRequiredState is 0 or 1;
|
||||
var newInstanceTask = forceFrameworkThread ? framework.RunOnFrameworkThread(Create) : Create();
|
||||
this.instance = await newInstanceTask.ConfigureAwait(false);
|
||||
|
||||
async Task<IDalamudPlugin> Create() =>
|
||||
(IDalamudPlugin)await this.ServiceScope!.CreateAsync(this.pluginType!, this.DalamudInterface!);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Exception in plugin constructor");
|
||||
Log.Error(ex, "Exception during plugin initialization");
|
||||
this.instance = null;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue