Fix OverlayManager.RemoveOverlay (#5623)

This commit is contained in:
Leon Friedrich
2025-01-20 12:14:58 +11:00
committed by GitHub
parent 8f2817aa4e
commit 4ba6687b9d
2 changed files with 3 additions and 4 deletions

View File

@@ -43,7 +43,7 @@ END TEMPLATE-->
### Bugfixes
*None yet*
* Fixed one of the `IOverlayManager.RemoveOverlay` overrides not fully removing the overlay.
### Other

View File

@@ -40,10 +40,9 @@ internal sealed class OverlayManager : IOverlayManagerInternal, IPostInjectInit
public bool AddOverlay(Overlay overlay)
{
if (_overlays.ContainsKey(overlay.GetType()))
if (!_overlays.TryAdd(overlay.GetType(), overlay))
return false;
_overlays.Add(overlay.GetType(), overlay);
Sort();
return true;
}
@@ -68,7 +67,7 @@ internal sealed class OverlayManager : IOverlayManagerInternal, IPostInjectInit
public bool RemoveOverlay(Overlay overlay)
{
return _overlays.Remove(overlay.GetType());
return RemoveOverlay(overlay.GetType());
}
public bool TryGetOverlay(Type overlayClass, [NotNullWhen(true)] out Overlay? overlay)