Skip to content

Commit

Permalink
dispose LineCombatant on plugin deinit
Browse files Browse the repository at this point in the history
  • Loading branch information
marzent committed May 28, 2023
1 parent 3381150 commit 41ba0a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions OverlayPlugin.Core/Integration/LineCombatant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace RainbowMage.OverlayPlugin.MemoryProcessors.Combatant
{
public class LineCombatant
public class LineCombatant: IDisposable
{
public const uint LogFileLineID = 261;
private ILogger logger;
Expand Down Expand Up @@ -216,11 +216,14 @@ public LineCombatant(TinyIoCContainer container)
}

~LineCombatant()
{
Dispose();
}

public void Dispose()
{
if (cancellationToken != null)
{
cancellationToken.Cancel();
}
}

private void PollCombatants()
Expand Down
3 changes: 3 additions & 0 deletions OverlayPlugin.Core/PluginMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ public void DeInitPlugin()

this.Overlays.Clear();
}

var lineCombatant = _container.Resolve<LineCombatant>();
lineCombatant.Dispose();

try
{
Expand Down

0 comments on commit 41ba0a2

Please sign in to comment.