LCL: Fix TCustomListbox not releasing Canvas handle in DestroyWnd (issue #34249).

git-svn-id: trunk@59094 -
This commit is contained in:
wp 2018-09-20 10:47:53 +00:00
parent 080e9177b5
commit 7bcf1cc533
2 changed files with 11 additions and 2 deletions

View File

@ -128,6 +128,13 @@ begin
UnlockSelectionChange;
end;
procedure TCustomListbox.DestroyWnd;
begin
inherited;
if FCanvas <> nil then
TControlCanvas(FCanvas).FreeHandle;
end;
{------------------------------------------------------------------------------
procedure TCustomListBox.FinalizeWnd
------------------------------------------------------------------------------}
@ -296,9 +303,10 @@ begin
begin
if Self.ItemHeight <> 0 then
AHeight := Self.ItemHeight
else
else begin
Canvas.Font := Font;
AHeight := Canvas.TextHeight('Hg');
end;
MeasureItem(Integer(ItemId), AHeight);
if AHeight > 0 then
ItemHeight := AHeight;

View File

@ -548,6 +548,7 @@ type
function CalculateStandardItemHeight: Integer;
procedure CreateParams(var Params: TCreateParams); override;
procedure InitializeWnd; override;
procedure DestroyWnd; override;
procedure FinalizeWnd; override;
class function GetControlClassDefaultSize: TSize; override;
procedure CheckIndex(const AIndex: Integer);