mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 01:57:55 +08:00
Merge branch '1.8.x' into 1.x
This commit is contained in:
@@ -277,22 +277,25 @@ namespace Orchard.Environment {
|
|||||||
// terminate the shell if the tenant was disabled
|
// terminate the shell if the tenant was disabled
|
||||||
else if (settings.State == TenantState.Disabled) {
|
else if (settings.State == TenantState.Disabled) {
|
||||||
shellContext.Shell.Terminate();
|
shellContext.Shell.Terminate();
|
||||||
shellContext.Dispose();
|
|
||||||
_runningShellTable.Remove(settings);
|
_runningShellTable.Remove(settings);
|
||||||
|
|
||||||
_shellContexts = _shellContexts.Where(shell => shell.Settings.Name != settings.Name);
|
// Forcing enumeration with ToArray() so a lazy execution isn't causing issues by accessing the disposed context.
|
||||||
|
_shellContexts = _shellContexts.Where(shell => shell.Settings.Name != settings.Name).ToArray();
|
||||||
|
|
||||||
|
shellContext.Dispose();
|
||||||
}
|
}
|
||||||
// reload the shell as its settings have changed
|
// reload the shell as its settings have changed
|
||||||
else {
|
else {
|
||||||
// dispose previous context
|
// dispose previous context
|
||||||
shellContext.Shell.Terminate();
|
shellContext.Shell.Terminate();
|
||||||
shellContext.Dispose();
|
|
||||||
|
|
||||||
var context = _shellContextFactory.CreateShellContext(settings);
|
var context = _shellContextFactory.CreateShellContext(settings);
|
||||||
|
|
||||||
// activate and register modified context
|
// Sctivate and register modified context.
|
||||||
_shellContexts = _shellContexts.Where(shell => shell.Settings.Name != settings.Name).Union(new[] { context });
|
// Forcing enumeration with ToArray() so a lazy execution isn't causing issues by accessing the disposed shell context.
|
||||||
|
_shellContexts = _shellContexts.Where(shell => shell.Settings.Name != settings.Name).Union(new[] { context }).ToArray();
|
||||||
|
|
||||||
|
shellContext.Dispose();
|
||||||
context.Shell.Activate();
|
context.Shell.Activate();
|
||||||
|
|
||||||
_runningShellTable.Update(settings);
|
_runningShellTable.Update(settings);
|
||||||
|
Reference in New Issue
Block a user