In TextBlock.Paint(), PaintSelectionBackground is explicitly disposed after use, but PaintSelectionHandle is not.
Since PaintSelectionHandle is created inside the Paint method (when selection handles are enabled), it should be disposed to avoid leaking native memory on every paint call.
// TextBlock.cs
if (ShowSelectionHandles)
{
using (var paint = PaintSelectionHandle)
{
// ... use paint ...
}
}
Currently, it's just var paint = PaintSelectionHandle; without disposal.
In
TextBlock.Paint(),PaintSelectionBackgroundis explicitly disposed after use, butPaintSelectionHandleis not.Since
PaintSelectionHandleis created inside thePaintmethod (when selection handles are enabled), it should be disposed to avoid leaking native memory on every paint call.Currently, it's just
var paint = PaintSelectionHandle;without disposal.