make sure no plugins are lost when deleting a profile

This commit is contained in:
goat 2023-04-10 20:14:06 +02:00
parent e93e1cc806
commit 2ed215b74b
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B

View file

@ -237,6 +237,12 @@ internal class ProfileManager : IServiceType
/// <param name="profile">The profile to delete.</param>
public void DeleteProfile(Profile profile)
{
// We need to remove all plugins from the profile first, so that they are re-added to the default profile if needed
foreach (var plugin in profile.Plugins)
{
profile.Remove(plugin.InternalName, false);
}
Debug.Assert(this.config.SavedProfiles!.Remove(profile.Model), "this.config.SavedProfiles!.Remove(profile.Model)");
Debug.Assert(this.profiles.Remove(profile), "this.profiles.Remove(profile)");