mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +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
|
try
|
||||||
{
|
{
|
||||||
UpdateQueue.RemoveReferencingObject(this);
|
UpdateQueue.RemoveReferencingObject(this);
|
||||||
UpdateQueue.Dispose();
|
if (!UpdateQueue.HasActiveReferences())
|
||||||
|
UpdateQueue.Dispose();
|
||||||
}
|
}
|
||||||
catch { /* :( */ }
|
catch { /* :( */ }
|
||||||
try { LedMapping.Clear(); } catch { /* this really shouldn't happen */ }
|
try { LedMapping.Clear(); } catch { /* this really shouldn't happen */ }
|
||||||
|
|||||||
@ -112,14 +112,8 @@ public abstract class UpdateQueue<TIdentifier, TData> : AbstractReferenceCountin
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>
|
|
||||||
/// Disposes this queue.
|
|
||||||
/// Checks if any referencing objects are registered and if so, will return without disposing!
|
|
||||||
/// </summary>
|
|
||||||
public virtual void Dispose()
|
public virtual void Dispose()
|
||||||
{
|
{
|
||||||
if (this.HasActiveReferences()) return;
|
|
||||||
|
|
||||||
_updateTrigger.Starting -= OnStartup;
|
_updateTrigger.Starting -= OnStartup;
|
||||||
_updateTrigger.Update -= OnUpdate;
|
_updateTrigger.Update -= OnUpdate;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user