1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-01-01 18:23:32 +00:00

Fixed module null references on shutdown

This commit is contained in:
SpoinkyNL 2016-11-09 13:15:46 +01:00
parent 2d9a656dde
commit 4c766f29b4
6 changed files with 45 additions and 41 deletions

View File

@ -51,7 +51,10 @@ namespace Artemis.Managers
ProfilePreviewModel == null) ProfilePreviewModel == null)
return; return;
lock (GameViewModels)
{
var activePreview = GameViewModels.FirstOrDefault(vm => vm.IsActive); var activePreview = GameViewModels.FirstOrDefault(vm => vm.IsActive);
if (activePreview == null) if (activePreview == null)
{ {
// Should not be active if no selected profile is set // Should not be active if no selected profile is set
@ -67,7 +70,8 @@ namespace Artemis.Managers
} }
else else
{ {
if (_effectManager.ActiveEffect != ProfilePreviewModel && !(_effectManager.ActiveEffect is GameModel)) if (_effectManager.ActiveEffect != ProfilePreviewModel &&
!(_effectManager.ActiveEffect is GameModel))
{ {
_logger.Debug("Activate profile preview"); _logger.Debug("Activate profile preview");
_effectManager.ChangeEffect(ProfilePreviewModel); _effectManager.ChangeEffect(ProfilePreviewModel);
@ -82,4 +86,5 @@ namespace Artemis.Managers
} }
} }
} }
}
} }

View File

@ -39,7 +39,7 @@ namespace Artemis.Modules.Games.GtaV
// Delay restoring the DLL to allow GTA to release it // Delay restoring the DLL to allow GTA to release it
Task.Factory.StartNew(() => Task.Factory.StartNew(() =>
{ {
Thread.Sleep(2000); Thread.Sleep(5000);
DllManager.RestoreLogitechDll(); DllManager.RestoreLogitechDll();
}); });
@ -59,17 +59,17 @@ namespace Artemis.Modules.Games.GtaV
private void PipeServerOnPipeMessage(string reply) private void PipeServerOnPipeMessage(string reply)
{ {
if (!Initialized) // if (!Initialized)
return; // return;
//
// Convert the given string to a list of ints // // Convert the given string to a list of ints
var stringParts = reply.Split(' '); // var stringParts = reply.Split(' ');
var parts = new string[stringParts.Length]; // var parts = new string[stringParts.Length];
for (var i = 0; i < stringParts.Length; i++) // for (var i = 0; i < stringParts.Length; i++)
parts[i] = stringParts[i]; // parts[i] = stringParts[i];
//
if (parts[0] == "0") // if (parts[0] == "0")
InterpertrateLighting(parts); // InterpertrateLighting(parts);
} }
private void InterpertrateLighting(string[] parts) private void InterpertrateLighting(string[] parts)

View File

@ -88,9 +88,9 @@ namespace Artemis.Modules.Games.Overwatch
{ {
Initialized = false; Initialized = false;
_stickyStatus.Dispose(); _stickyStatus?.Dispose();
_stickyUltimateReady.Dispose(); _stickyUltimateReady?.Dispose();
_stickyUltimateUsed.Dispose(); _stickyUltimateUsed?.Dispose();
_pipeServer.PipeMessage -= PipeServerOnPipeMessage; _pipeServer.PipeMessage -= PipeServerOnPipeMessage;
base.Dispose(); base.Dispose();

View File

@ -40,8 +40,8 @@ namespace Artemis.Modules.Games.TheDivision
DllManager.RestoreLogitechDll(); DllManager.RestoreLogitechDll();
}); });
_stickyAmmo.Dispose(); _stickyAmmo?.Dispose();
_stickyHp.Dispose(); _stickyHp?.Dispose();
_pipeServer.PipeMessage -= PipeServerOnPipeMessage; _pipeServer.PipeMessage -= PipeServerOnPipeMessage;
base.Dispose(); base.Dispose();

View File

@ -70,7 +70,7 @@ namespace Artemis.Modules.Games.WoW
{ {
Initialized = false; Initialized = false;
_process.Dispose(); _process?.Dispose();
_process = null; _process = null;
base.Dispose(); base.Dispose();
} }

View File

@ -62,7 +62,6 @@ namespace Artemis.Utilities.GameState
private void ListenerRun() private void ListenerRun()
{ {
// TODO: Check for UI issue
while (Running) while (Running)
{ {
_listener.BeginGetContext(HandleRequest, _listener); _listener.BeginGetContext(HandleRequest, _listener);