diff --git a/components/spktoolbar/SpkToolbar/spkt_Buttons.pas b/components/spktoolbar/SpkToolbar/spkt_Buttons.pas index e1bbec200..0a00589fb 100644 --- a/components/spktoolbar/SpkToolbar/spkt_Buttons.pas +++ b/components/spktoolbar/SpkToolbar/spkt_Buttons.pas @@ -48,6 +48,8 @@ type TSpkBaseButton = class; function IsVisibleLinked: Boolean; override; end; + { TSpkBaseButton } + TSpkBaseButton = class abstract(TSpkBaseItem) private FMouseHoverElement : TSpkMouseButtonElement; @@ -96,6 +98,7 @@ type TSpkBaseButton = class; public constructor Create(AOwner : TComponent); override; + destructor Destroy; override; procedure MouseLeave; override; procedure MouseDown(Button: TMouseButton; Shift: TShiftState; @@ -295,6 +298,12 @@ begin FMouseActiveElement:=beNone; end; +destructor TSpkBaseButton.Destroy; +begin + FreeAndNil(FActionLink); + inherited Destroy; +end; + procedure TSpkBaseButton.Click; begin if Assigned(FOnClick) then @@ -648,14 +657,14 @@ end; procedure TSpkBaseButton.SetAction(const Value: TBasicAction); begin if Value = nil then - begin - FActionLink.Free; - FActionLink := nil; - end + begin + FActionLink.Free; + FActionLink := nil; + end else - begin - if FActionLink = nil then - FActionLink := TSpkButtonActionLink.Create(self); + begin + if FActionLink = nil then + FActionLink := TSpkButtonActionLink.Create(self); FActionLink.Action := Value; FActionLink.OnChange := DoActionChange; ActionChange(Value, csLoading in Value.ComponentState);