mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
fix: sync profile/plugin lists when drawing profile manager
This commit is contained in:
parent
c68793b589
commit
00fd9079a9
3 changed files with 17 additions and 1 deletions
|
|
@ -111,6 +111,7 @@ internal class ProfileManagerWidget
|
||||||
{
|
{
|
||||||
Guid? toCloneGuid = null;
|
Guid? toCloneGuid = null;
|
||||||
|
|
||||||
|
using var syncScope = profman.GetSyncScope();
|
||||||
foreach (var profile in profman.Profiles)
|
foreach (var profile in profman.Profiles)
|
||||||
{
|
{
|
||||||
if (profile.IsDefaultProfile)
|
if (profile.IsDefaultProfile)
|
||||||
|
|
@ -329,7 +330,8 @@ internal class ProfileManagerWidget
|
||||||
var pluginLineHeight = 32 * ImGuiHelpers.GlobalScale;
|
var pluginLineHeight = 32 * ImGuiHelpers.GlobalScale;
|
||||||
string? wantRemovePluginInternalName = null;
|
string? wantRemovePluginInternalName = null;
|
||||||
|
|
||||||
foreach (var plugin in profile.Plugins)
|
using var syncScope = profile.GetSyncScope();
|
||||||
|
foreach (var plugin in profile.Plugins.ToArray())
|
||||||
{
|
{
|
||||||
didAny = true;
|
didAny = true;
|
||||||
var pmPlugin = pm.InstalledPlugins.FirstOrDefault(x => x.Manifest.InternalName == plugin.InternalName);
|
var pmPlugin = pm.InstalledPlugins.FirstOrDefault(x => x.Manifest.InternalName == plugin.InternalName);
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,13 @@ internal class Profile
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ProfileModel Model => this.modelV1;
|
public ProfileModel Model => this.modelV1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a disposable that will lock the plugin list while it is not disposed.
|
||||||
|
/// You must NEVER use this in async code.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The aforementioned disposable.</returns>
|
||||||
|
public IDisposable GetSyncScope() => new ScopedSyncRoot(this);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set this profile's state. This cannot be called for the default profile.
|
/// Set this profile's state. This cannot be called for the default profile.
|
||||||
/// This will block until all states have been applied.
|
/// This will block until all states have been applied.
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,13 @@ internal class ProfileManager : IServiceType
|
||||||
/// Gets a value indicating whether or not the profile manager is busy enabling/disabling plugins.
|
/// Gets a value indicating whether or not the profile manager is busy enabling/disabling plugins.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsBusy => this.isBusy;
|
public bool IsBusy => this.isBusy;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a disposable that will lock the profile list while it is not disposed.
|
||||||
|
/// You must NEVER use this in async code.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The aforementioned disposable.</returns>
|
||||||
|
public IDisposable GetSyncScope() => new ScopedSyncRoot(this.profiles);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if any enabled profile wants a specific plugin enabled.
|
/// Check if any enabled profile wants a specific plugin enabled.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue