diff --git a/MLEM.Ui/Elements/Panel.cs b/MLEM.Ui/Elements/Panel.cs
index d5f0dcb..a9633fb 100644
--- a/MLEM.Ui/Elements/Panel.cs
+++ b/MLEM.Ui/Elements/Panel.cs
@@ -15,7 +15,7 @@ namespace MLEM.Ui.Elements {
/// Additionally, a panel can be set to on construction, which causes all elements that don't fit into the panel to be hidden until scrolled to using a .
/// As this behavior is accomplished using a , scrolling panels need to have their methods called using .
///
- public class Panel : Element {
+ public class Panel : Element, IDisposable {
///
/// The texture that this panel should have, or null if it should be invisible.
@@ -76,6 +76,10 @@ namespace MLEM.Ui.Elements {
}
}
+ ~Panel() {
+ this.Dispose();
+ }
+
///
public override void ForceUpdateArea() {
if (this.scrollOverflow) {
@@ -231,5 +235,13 @@ namespace MLEM.Ui.Elements {
}
}
+ ///
+ public void Dispose() {
+ if (this.renderTarget != null) {
+ this.renderTarget.Dispose();
+ this.renderTarget = null;
+ }
+ }
+
}
}
\ No newline at end of file