mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Fixed module null references on shutdown
This commit is contained in:
parent
2d9a656dde
commit
4c766f29b4
@ -51,34 +51,39 @@ namespace Artemis.Managers
|
||||
ProfilePreviewModel == null)
|
||||
return;
|
||||
|
||||
var activePreview = GameViewModels.FirstOrDefault(vm => vm.IsActive);
|
||||
if (activePreview == null)
|
||||
lock (GameViewModels)
|
||||
{
|
||||
// Should not be active if no selected profile is set
|
||||
if (_effectManager.ActiveEffect != ProfilePreviewModel)
|
||||
return;
|
||||
var activePreview = GameViewModels.FirstOrDefault(vm => vm.IsActive);
|
||||
|
||||
_logger.Debug("Loading last effect after profile preview");
|
||||
var lastEffect = _effectManager.GetLastEffect();
|
||||
if (lastEffect != null)
|
||||
_effectManager.ChangeEffect(lastEffect);
|
||||
else
|
||||
_effectManager.ClearEffect();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_effectManager.ActiveEffect != ProfilePreviewModel && !(_effectManager.ActiveEffect is GameModel))
|
||||
if (activePreview == null)
|
||||
{
|
||||
_logger.Debug("Activate profile preview");
|
||||
_effectManager.ChangeEffect(ProfilePreviewModel);
|
||||
// Should not be active if no selected profile is set
|
||||
if (_effectManager.ActiveEffect != ProfilePreviewModel)
|
||||
return;
|
||||
|
||||
_logger.Debug("Loading last effect after profile preview");
|
||||
var lastEffect = _effectManager.GetLastEffect();
|
||||
if (lastEffect != null)
|
||||
_effectManager.ChangeEffect(lastEffect);
|
||||
else
|
||||
_effectManager.ClearEffect();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_effectManager.ActiveEffect != ProfilePreviewModel &&
|
||||
!(_effectManager.ActiveEffect is GameModel))
|
||||
{
|
||||
_logger.Debug("Activate profile preview");
|
||||
_effectManager.ChangeEffect(ProfilePreviewModel);
|
||||
}
|
||||
|
||||
// LoopManager might be running, this method won't do any harm in that case.
|
||||
_loopManager.StartAsync();
|
||||
// LoopManager might be running, this method won't do any harm in that case.
|
||||
_loopManager.StartAsync();
|
||||
|
||||
ProfilePreviewModel.ProfileViewModel = activePreview.ProfileEditor.ProfileViewModel;
|
||||
if (!ReferenceEquals(ProfilePreviewModel.Profile, activePreview.ProfileEditor.SelectedProfile))
|
||||
ProfilePreviewModel.Profile = activePreview.ProfileEditor.SelectedProfile;
|
||||
ProfilePreviewModel.ProfileViewModel = activePreview.ProfileEditor.ProfileViewModel;
|
||||
if (!ReferenceEquals(ProfilePreviewModel.Profile, activePreview.ProfileEditor.SelectedProfile))
|
||||
ProfilePreviewModel.Profile = activePreview.ProfileEditor.SelectedProfile;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ namespace Artemis.Modules.Games.GtaV
|
||||
// Delay restoring the DLL to allow GTA to release it
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
Thread.Sleep(2000);
|
||||
Thread.Sleep(5000);
|
||||
DllManager.RestoreLogitechDll();
|
||||
});
|
||||
|
||||
@ -59,17 +59,17 @@ namespace Artemis.Modules.Games.GtaV
|
||||
|
||||
private void PipeServerOnPipeMessage(string reply)
|
||||
{
|
||||
if (!Initialized)
|
||||
return;
|
||||
|
||||
// Convert the given string to a list of ints
|
||||
var stringParts = reply.Split(' ');
|
||||
var parts = new string[stringParts.Length];
|
||||
for (var i = 0; i < stringParts.Length; i++)
|
||||
parts[i] = stringParts[i];
|
||||
|
||||
if (parts[0] == "0")
|
||||
InterpertrateLighting(parts);
|
||||
// if (!Initialized)
|
||||
// return;
|
||||
//
|
||||
// // Convert the given string to a list of ints
|
||||
// var stringParts = reply.Split(' ');
|
||||
// var parts = new string[stringParts.Length];
|
||||
// for (var i = 0; i < stringParts.Length; i++)
|
||||
// parts[i] = stringParts[i];
|
||||
//
|
||||
// if (parts[0] == "0")
|
||||
// InterpertrateLighting(parts);
|
||||
}
|
||||
|
||||
private void InterpertrateLighting(string[] parts)
|
||||
|
||||
@ -88,9 +88,9 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
{
|
||||
Initialized = false;
|
||||
|
||||
_stickyStatus.Dispose();
|
||||
_stickyUltimateReady.Dispose();
|
||||
_stickyUltimateUsed.Dispose();
|
||||
_stickyStatus?.Dispose();
|
||||
_stickyUltimateReady?.Dispose();
|
||||
_stickyUltimateUsed?.Dispose();
|
||||
|
||||
_pipeServer.PipeMessage -= PipeServerOnPipeMessage;
|
||||
base.Dispose();
|
||||
|
||||
@ -40,8 +40,8 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
DllManager.RestoreLogitechDll();
|
||||
});
|
||||
|
||||
_stickyAmmo.Dispose();
|
||||
_stickyHp.Dispose();
|
||||
_stickyAmmo?.Dispose();
|
||||
_stickyHp?.Dispose();
|
||||
|
||||
_pipeServer.PipeMessage -= PipeServerOnPipeMessage;
|
||||
base.Dispose();
|
||||
|
||||
@ -70,7 +70,7 @@ namespace Artemis.Modules.Games.WoW
|
||||
{
|
||||
Initialized = false;
|
||||
|
||||
_process.Dispose();
|
||||
_process?.Dispose();
|
||||
_process = null;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
@ -62,7 +62,6 @@ namespace Artemis.Utilities.GameState
|
||||
|
||||
private void ListenerRun()
|
||||
{
|
||||
// TODO: Check for UI issue
|
||||
while (Running)
|
||||
{
|
||||
_listener.BeginGetContext(HandleRequest, _listener);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user