Fixed potential memory leak.

This commit is contained in:
RKrom 2014-06-02 09:35:01 +02:00
commit 4d6bf9f1ad

View file

@ -110,9 +110,11 @@ namespace Greenshot.Drawing {
SetArrowHeads((ArrowHeadCombination)GetFieldValue(FieldType.ARROWHEADS), pen); SetArrowHeads((ArrowHeadCombination)GetFieldValue(FieldType.ARROWHEADS), pen);
using (GraphicsPath path = new GraphicsPath()) { using (GraphicsPath path = new GraphicsPath()) {
path.AddLine(Left, Top, Left + Width, Top + Height); path.AddLine(Left, Top, Left + Width, Top + Height);
Rectangle drawingBounds = Rectangle.Round(path.GetBounds(new Matrix(), pen)); using (Matrix matrix = new Matrix()) {
drawingBounds.Inflate(2, 2); Rectangle drawingBounds = Rectangle.Round(path.GetBounds(matrix, pen));
return drawingBounds; drawingBounds.Inflate(2, 2);
return drawingBounds;
}
} }
} }
} }