Skip to content

Commit a10a60e

Browse files
Fixed #36 memory leak in Vcl.ButtonStylesAttributes.pas
1 parent 536b0a7 commit a10a60e

File tree

7 files changed

+50
-32
lines changed

7 files changed

+50
-32
lines changed

README.htm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</style>
3232
<h1>Delphi VCL StyledComponents <a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg" alt="License"/></a></h1>
3333
<h2>Components similar to Delphi VCL Buttons, Toolbar, DbNavigator, BindNavigator, ButtonGroup and CategoryButtons with Custom Graphic Styles, and an advanced, full-customizable TaskDialog, also with animations!</h2>
34-
<h3>Actual official version: 3.6.3</h3>
34+
<h3>Actual official version: 3.6.4</h3>
3535
<hr />
3636
<h2>A brief description</h2>
3737
<p><strong>StyledComponents</strong> is a set of VCL components for Delphi (32 and 64 bit) that allow you to overcome the limits imposed by standard VCL components, maintaining 100% compatibility of the properties.</p>
@@ -344,6 +344,10 @@ <h3>Available from Delphi XE6 to Delphi 12 (32bit and 64bit platforms)</h3>
344344
<p><img src="./Images/SupportingDelphi.jpg" alt="Delphi Support"/></p>
345345
<p>Related links: <a href="https://www.embarcadero.com">embarcadero.com</a> - <a href="https://learndelphi.org">learndelphi.org</a></p>
346346
<h3>RELEASE NOTES</h3>
347+
<p>26 Aug 2024: version 3.6.4</p>
348+
<ul>
349+
<li>Fixed memory leak in Vcl.ButtonStylesAttributes.pas</li>
350+
</ul>
347351
<p>20 Aug 2024: version 3.6.3</p>
348352
<ul>
349353
<li>Added AutoClick and AutoClickDelay properties to StyledButton and StyledGraphicButton</li>

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Components similar to Delphi VCL Buttons, Toolbar, DbNavigator, BindNavigator, ButtonGroup and CategoryButtons with Custom Graphic Styles, and an advanced, full-customizable TaskDialog, also with animations!
44

5-
### Actual official version: 3.6.3
5+
### Actual official version: 3.6.4
66

77
---
88
## A brief description
@@ -397,6 +397,9 @@ If you are have Skia4Delphi installed, you can also try the AnimatedTaskDialogDe
397397
Related links: [embarcadero.com](https://www.embarcadero.com) - [learndelphi.org](https://learndelphi.org)
398398

399399
### RELEASE NOTES
400+
26 Aug 2024: version 3.6.4
401+
- Fixed memory leak in Vcl.ButtonStylesAttributes.pas
402+
400403
20 Aug 2024: version 3.6.3
401404
- Added AutoClick and AutoClickDelay properties to StyledButton and StyledGraphicButton
402405
- Added AutoClick and AutoClickDelay properties to StyledTaskDialog

packages/D11/StyledAnimatedComponents.dproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@
130130
<Source Name="MainSource">StyledAnimatedComponents.dpk</Source>
131131
</Source>
132132
<Excluded_Packages/>
133+
<WelcomePageFile Path="..\..\README.htm"/>
134+
<WelcomePageFolder/>
133135
</Delphi.Personality>
134136
<Platforms>
135137
<Platform value="Win32">True</Platform>

packages/D11/StyledComponents.dproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@
141141
<Source Name="MainSource">StyledComponents.dpk</Source>
142142
</Source>
143143
<Excluded_Packages/>
144+
<WelcomePageFile Path="..\..\README.htm"/>
145+
<WelcomePageFolder/>
144146
</Delphi.Personality>
145147
<Platforms>
146148
<Platform value="Win32">True</Platform>
0 Bytes
Binary file not shown.

packages/D12/dclStyledComponents.res

0 Bytes
Binary file not shown.

source/Vcl.ButtonStylesAttributes.pas

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,42 +1534,45 @@ function GetRoundedCornersPath(ARectangle: TGPRectF;
15341534
const
15351535
d0 = 0.0001;
15361536
var
1537-
LPath : TGPGraphicsPath;
15381537
l, t, w, h, d : Single;
15391538
begin
1540-
LPath := TGPGraphicsPath.Create;
1541-
l := ARectangle.X;
1542-
t := ARectangle.Y;
1543-
w := ARectangle.Width;
1544-
h := ARectangle.Height;
1545-
d := ARadius / 2;
1546-
d := Min(d, Min(ARectangle.Width, ARectangle.Height));
1547-
// topleft
1548-
if rcTopLeft in ARoundedCorners then
1549-
LPath.AddArc(l, t, d, d, 180, 90)
1550-
else
1551-
LPath.AddArc(l, t, d0, d0, 180, 90);
1539+
Result := TGPGraphicsPath.Create;
1540+
try
1541+
l := ARectangle.X;
1542+
t := ARectangle.Y;
1543+
w := ARectangle.Width;
1544+
h := ARectangle.Height;
1545+
d := ARadius / 2;
1546+
d := Min(d, Min(ARectangle.Width, ARectangle.Height));
1547+
// topleft
1548+
if rcTopLeft in ARoundedCorners then
1549+
Result.AddArc(l, t, d, d, 180, 90)
1550+
else
1551+
Result.AddArc(l, t, d0, d0, 180, 90);
15521552

1553-
// topright
1554-
if rcTopRight in ARoundedCorners then
1555-
LPath.AddArc(l + w - d, t, d, d, 270, 90)
1556-
else
1557-
LPath.AddArc(l + w - d0, t, d0, d0, 270, 90);
1553+
// topright
1554+
if rcTopRight in ARoundedCorners then
1555+
Result.AddArc(l + w - d, t, d, d, 270, 90)
1556+
else
1557+
Result.AddArc(l + w - d0, t, d0, d0, 270, 90);
15581558

1559-
// bottomright
1560-
if rcBottomRight in ARoundedCorners then
1561-
LPath.AddArc(l + w - d, t + h - d, d, d, 0, 90)
1562-
else
1563-
LPath.AddArc(l + w - d0, t + h - d0, d0, d0, 0, 90);
1559+
// bottomright
1560+
if rcBottomRight in ARoundedCorners then
1561+
Result.AddArc(l + w - d, t + h - d, d, d, 0, 90)
1562+
else
1563+
Result.AddArc(l + w - d0, t + h - d0, d0, d0, 0, 90);
15641564

1565-
// bottomleft
1566-
if rcBottomLeft in ARoundedCorners then
1567-
LPath.AddArc(l, t + h - d, d, d, 90, 90)
1568-
else
1569-
LPath.AddArc(l, t + h - d0, d0, d0, 90, 90);
1565+
// bottomleft
1566+
if rcBottomLeft in ARoundedCorners then
1567+
Result.AddArc(l, t + h - d, d, d, 90, 90)
1568+
else
1569+
Result.AddArc(l, t + h - d0, d0, d0, 90, 90);
15701570

1571-
LPath.CloseFigure();
1572-
result := LPath;
1571+
Result.CloseFigure();
1572+
except
1573+
FreeAndNil(Result);
1574+
raise;
1575+
end
15731576
end;
15741577

15751578
function GPColor(AColor: TColor): TGPColor;
@@ -2217,6 +2220,8 @@ procedure CanvasDrawShape(const ACanvas: TCanvas; ARect: TRect;
22172220
begin
22182221
LGraphics := nil;
22192222
LPen := nil;
2223+
LBrush := nil;
2224+
LPath := nil;
22202225
try
22212226
X := ARect.Left;
22222227
Y := ARect.Top;
@@ -2272,6 +2277,8 @@ procedure CanvasDrawShape(const ACanvas: TCanvas; ARect: TRect;
22722277
finally
22732278
LGraphics.Free;
22742279
LPen.Free;
2280+
LBrush.Free;
2281+
LPath.Free;
22752282
end;
22762283
end;
22772284
{$else}

0 commit comments

Comments
 (0)