Moved reference check for UpdateQueue disposal to the caller to prevent issues with Dispose-overrides

This commit is contained in:
DarthAffe committed 2023-04-08 14:42:56 +02:00
1 parent d054d16c10
commit 5b514ff962
2 files changed
+1 -6

No files matched your search

@@ -162,6 +162,7 @@ public abstract class AbstractRGBDevice<TDeviceInfo> : Placeable, IRGBDevice<TDe
try
{
UpdateQueue.RemoveReferencingObject(this);
if (!UpdateQueue.HasActiveReferences())
UpdateQueue.Dispose();
}
catch { /* :( */ }
@@ -112,14 +112,8 @@ public abstract class UpdateQueue<TIdentifier, TData> : AbstractReferenceCountin
}
/// <inheritdoc />
/// <summary>
/// Disposes this queue.
/// Checks if any referencing objects are registered and if so, will return without disposing!
/// </summary>
public virtual void Dispose()
{
if (this.HasActiveReferences()) return;
_updateTrigger.Starting -= OnStartup;
_updateTrigger.Update -= OnUpdate;