mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-12 17:48:31 +00:00
Moved reference check for UpdateQueue disposal to the caller to prevent issues with Dispose-overrides
This commit is contained in:
parent
d054d16c10
commit
5b514ff962
@ -162,7 +162,8 @@ public abstract class AbstractRGBDevice<TDeviceInfo> : Placeable, IRGBDevice<TDe
|
||||
try
|
||||
{
|
||||
UpdateQueue.RemoveReferencingObject(this);
|
||||
UpdateQueue.Dispose();
|
||||
if (!UpdateQueue.HasActiveReferences())
|
||||
UpdateQueue.Dispose();
|
||||
}
|
||||
catch { /* :( */ }
|
||||
try { LedMapping.Clear(); } catch { /* this really shouldn't happen */ }
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user