mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix deadlock when loading new settings
This commit is contained in:
parent
bdb60f26a7
commit
21bf0a87c9
@ -5,9 +5,9 @@ public class MainSettings
|
|||||||
public const string SettingsFileName = "app_settings";
|
public const string SettingsFileName = "app_settings";
|
||||||
private const int SettingsVersion = 1;
|
private const int SettingsVersion = 1;
|
||||||
|
|
||||||
public int CurrentSettingsVersion { get; private set; }
|
public int CurrentSettingsVersion { get; set; }
|
||||||
|
|
||||||
public PerformanceSettings PerformanceSettings { get; } = new();
|
public PerformanceSettings PerformanceSettings { get; set; } = new();
|
||||||
|
|
||||||
public bool Upgrade()
|
public bool Upgrade()
|
||||||
{
|
{
|
||||||
|
@ -100,8 +100,8 @@ public static class ServiceExtensions
|
|||||||
|
|
||||||
MainSettings GetAppSettings(IServiceProvider provider, string name)
|
MainSettings GetAppSettings(IServiceProvider provider, string name)
|
||||||
{
|
{
|
||||||
var settingsManager = provider.GetService<SettingsManager>();
|
var settingsManager = provider.GetRequiredService<SettingsManager>();
|
||||||
var settings = settingsManager!.Load<MainSettings>(name).Result;
|
var settings = Task.Run(() => settingsManager.Load<MainSettings>(name)).Result;
|
||||||
if (settings.Upgrade())
|
if (settings.Upgrade())
|
||||||
{
|
{
|
||||||
settingsManager.Save(MainSettings.SettingsFileName, settings).FireAndForget();
|
settingsManager.Save(MainSettings.SettingsFileName, settings).FireAndForget();
|
||||||
|
Loading…
Reference in New Issue
Block a user