LCL/TColorButton: Add missing Notification method to prevent crash when assigned ColorDialog is deleted.

This commit is contained in:
wp_xyz 2021-12-16 00:37:00 +01:00
parent e0c4d9c77b
commit 285ed6ea0d
2 changed files with 8 additions and 0 deletions

View File

@ -312,6 +312,7 @@ type
function GetDisabledPattern: TBitmap; virtual;
function GetGlyphSize(Drawing: Boolean; PaintRect: TRect): TSize; override;
class function GetControlClassDefaultSize: TSize; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure ShowColorDialog; virtual;
public
constructor Create(AnOwner: TComponent); override;

View File

@ -148,6 +148,13 @@ begin
Result.CY := 25;
end;
procedure TColorButton.Notification(AComponent: TComponent; Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if (Operation = opRemove) and (AComponent = FColorDialog) then
FColorDialog := nil;
end;
procedure TColorButton.SetButtonColorSize(const AValue: Integer);
begin
if FButtonColorSize = AValue then Exit;