mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-31 01:42:02 +00:00
Plugins - Fixed a deadlock during plugin load
This commit is contained in:
parent
835c730060
commit
4d0a6fc330
@ -196,25 +196,24 @@ namespace Artemis.Core.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (_plugins)
|
// ReSharper disable InconsistentlySynchronizedField - It's read-only, idc
|
||||||
|
_logger.Debug("Loaded {count} plugin(s)", _plugins.Count);
|
||||||
|
|
||||||
|
bool mustElevate = !isElevated && _plugins.Any(p => p.Entity.IsEnabled && p.Info.RequiresAdmin);
|
||||||
|
if (mustElevate)
|
||||||
{
|
{
|
||||||
_logger.Debug("Loaded {count} plugin(s)", _plugins.Count);
|
_logger.Information("Restarting because one or more plugins requires elevation");
|
||||||
|
// No need for a delay this early on, nothing that needs graceful shutdown is happening yet
|
||||||
bool mustElevate = !isElevated && _plugins.Any(p => p.Entity.IsEnabled && p.Info.RequiresAdmin);
|
Utilities.Restart(true, TimeSpan.Zero);
|
||||||
if (mustElevate)
|
return;
|
||||||
{
|
|
||||||
_logger.Information("Restarting because one or more plugins requires elevation");
|
|
||||||
// No need for a delay this early on, nothing that needs graceful shutdown is happening yet
|
|
||||||
Utilities.Restart(true, TimeSpan.Zero);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (Plugin plugin in _plugins.Where(p => p.Entity.IsEnabled))
|
|
||||||
EnablePlugin(plugin, false, ignorePluginLock);
|
|
||||||
|
|
||||||
_logger.Debug("Enabled {count} plugin(s)", _plugins.Where(p => p.IsEnabled).Sum(p => p.Features.Count(f => f.IsEnabled)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (Plugin plugin in _plugins.Where(p => p.Entity.IsEnabled))
|
||||||
|
EnablePlugin(plugin, false, ignorePluginLock);
|
||||||
|
|
||||||
|
_logger.Debug("Enabled {count} plugin(s)", _plugins.Where(p => p.IsEnabled).Sum(p => p.Features.Count(f => f.IsEnabled)));
|
||||||
|
// ReSharper restore InconsistentlySynchronizedField
|
||||||
|
|
||||||
LoadingPlugins = false;
|
LoadingPlugins = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user