diff --git a/RGB.NET.Core/RGBSurface.cs b/RGB.NET.Core/RGBSurface.cs
index f990dcd..c7b664c 100644
--- a/RGB.NET.Core/RGBSurface.cs
+++ b/RGB.NET.Core/RGBSurface.cs
@@ -11,7 +11,7 @@ namespace RGB.NET.Core
///
/// Represents a RGB-surface containing multiple devices.
///
- public partial class RGBSurface : AbstractBindable
+ public partial class RGBSurface : AbstractBindable, IDisposable
{
#region Properties & Fields
@@ -99,6 +99,18 @@ namespace RGB.NET.Core
}
}
+ ///
+ public void Dispose()
+ {
+ foreach (IRGBDevice device in _devices)
+ try { device.Dispose(); }
+ catch { /* We do what we can */ }
+
+ _ledGroups.Clear();
+ _devices = null;
+ _deviceProvider = null;
+ }
+
///
/// Renders a ledgroup.
///