mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-12-26 10:19:22 +01:00
dispose of the panel's render target
This commit is contained in:
parent
ed02a83879
commit
0dad4860c1
1 changed files with 13 additions and 1 deletions
|
@ -15,7 +15,7 @@ namespace MLEM.Ui.Elements {
|
|||
/// Additionally, a panel can be set to <see cref="scrollOverflow"/> on construction, which causes all elements that don't fit into the panel to be hidden until scrolled to using a <see cref="ScrollBar"/>.
|
||||
/// As this behavior is accomplished using a <see cref="RenderTarget2D"/>, scrolling panels need to have their <see cref="DrawEarly"/> methods called using <see cref="UiSystem.DrawEarly"/>.
|
||||
/// </summary>
|
||||
public class Panel : Element {
|
||||
public class Panel : Element, IDisposable {
|
||||
|
||||
/// <summary>
|
||||
/// 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();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceUpdateArea() {
|
||||
if (this.scrollOverflow) {
|
||||
|
@ -231,5 +235,13 @@ namespace MLEM.Ui.Elements {
|
|||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose() {
|
||||
if (this.renderTarget != null) {
|
||||
this.renderTarget.Dispose();
|
||||
this.renderTarget = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue