RenderTarget2D allocates unmanaged resources (GPU memory) and thus Dispose() must be called at appropriate an time. I can find at least two classes that uses RenderTarget2D: UserInterface and Panel. I suggest that these two classes implement IDisposable so that the user can free/dispose the unmanaged resources.
I create multiple UserInterface instances and currently I do x.RenderTarget?.Dispose(), however, the RenderTarget2D of the Panel is protected and there is no getter for it.
Furthermore, there are at least two cases where _renderTarget is set to null without first calling Dispose().
UserInterface.cs:141:
set { _useRenderTarget = value; _renderTarget = null; }
Panel.cs:163:
if (_overflowMode == PanelOverflowBehavior.Overflow)
{
_renderTarget = null;
return;
}
RenderTarget2D
allocates unmanaged resources (GPU memory) and thusDispose()
must be called at appropriate an time. I can find at least two classes that usesRenderTarget2D
:UserInterface
andPanel
. I suggest that these two classes implementIDisposable
so that the user can free/dispose the unmanaged resources.I create multiple
UserInterface
instances and currently I dox.RenderTarget?.Dispose()
, however, theRenderTarget2D
of thePanel
is protected and there is no getter for it.Furthermore, there are at least two cases where
_renderTarget
is set tonull
without first callingDispose()
.UserInterface.cs:141:
Panel.cs:163: