chore: lock plugin lists when applying profile want state

This commit is contained in:
goat 2023-06-19 20:04:59 +02:00
parent 10276a651d
commit 3d47e05ab0
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
2 changed files with 5 additions and 3 deletions

View file

@ -162,7 +162,7 @@ internal partial class PluginManager : IDisposable, IServiceType
}
/// <summary>
/// Gets a list of all available plugins.
/// Gets a copy of the list of all available plugins.
/// </summary>
public IEnumerable<RemotePluginManifest> AvailablePlugins
{
@ -176,7 +176,7 @@ internal partial class PluginManager : IDisposable, IServiceType
}
/// <summary>
/// Gets a list of all plugins with an available update.
/// Gets a copy of the list of all plugins with an available update.
/// </summary>
public IEnumerable<AvailablePluginUpdate> UpdatablePlugins
{

View file

@ -169,6 +169,9 @@ internal class ProfileManager : IServiceType
/// </summary>
public void ApplyAllWantStates()
{
var pm = Service<PluginManager>.Get();
using var pmLock = pm.LockPluginLists();
this.isBusy = true;
Log.Information("Getting want states...");
@ -185,7 +188,6 @@ internal class ProfileManager : IServiceType
Log.Information("Applying want states...");
var pm = Service<PluginManager>.Get();
var tasks = new List<Task>();
foreach (var installedPlugin in pm.InstalledPlugins)