fix: defer saving config
This commit is contained in:
parent
faab0401a4
commit
ff107016f7
|
@ -52,9 +52,6 @@ public sealed class Plugin : IDalamudPlugin {
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal PartyList PartyList { get; init; }
|
internal PartyList PartyList { get; init; }
|
||||||
|
|
||||||
[PluginService]
|
|
||||||
internal SigScanner SigScanner { get; init; }
|
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal TargetManager TargetManager { get; init; }
|
internal TargetManager TargetManager { get; init; }
|
||||||
|
|
||||||
|
@ -65,11 +62,13 @@ public sealed class Plugin : IDalamudPlugin {
|
||||||
internal Store Store { get; }
|
internal Store Store { get; }
|
||||||
internal PluginUi Ui { get; }
|
internal PluginUi Ui { get; }
|
||||||
|
|
||||||
|
internal int DeferredSaveFrames = -1;
|
||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
public Plugin() {
|
public Plugin() {
|
||||||
LanguageChanged(this.Interface!.UiLanguage);
|
LanguageChanged(this.Interface!.UiLanguage);
|
||||||
|
|
||||||
this.Config = this.Interface!.GetPluginConfig() as Configuration ?? new Configuration();
|
this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration();
|
||||||
this.Config.Migrate();
|
this.Config.Migrate();
|
||||||
this.Common = new XivCommonBase();
|
this.Common = new XivCommonBase();
|
||||||
this.TextureCache = new TextureCache(this.DataManager!);
|
this.TextureCache = new TextureCache(this.DataManager!);
|
||||||
|
@ -111,6 +110,10 @@ public sealed class Plugin : IDalamudPlugin {
|
||||||
};
|
};
|
||||||
|
|
||||||
private void FrameworkUpdate(Framework framework) {
|
private void FrameworkUpdate(Framework framework) {
|
||||||
|
if (this.DeferredSaveFrames >= 0 && this.DeferredSaveFrames-- == 0) {
|
||||||
|
this.SaveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.Config.HideChat) {
|
if (!this.Config.HideChat) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,9 @@ internal sealed class Settings : IUiComponent {
|
||||||
|
|
||||||
config.UpdateFrom(this.Mutable);
|
config.UpdateFrom(this.Mutable);
|
||||||
|
|
||||||
this.Ui.Plugin.SaveConfig();
|
// save after 60 frames have passed, which should hopefully not
|
||||||
|
// commit any changes that cause a crash
|
||||||
|
this.Ui.Plugin.DeferredSaveFrames = 60;
|
||||||
|
|
||||||
this.Ui.Plugin.Store.FilterAllTabs(false);
|
this.Ui.Plugin.Store.FilterAllTabs(false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user