Access Violation in AdvShapeButton

advshapebutton.pas ver 6.2.1.5 size 147 909



procedure TAdvCustomShapeButton.SwitchMetro(Value: Boolean)

….

line 2079, creating FMetroAppearance object:

    if not Assigned(FMetroAppearance) then

      FMetroAppearance := TAdvShapeButtonAppearance.Create(Self);



next line 2085:

    FMetroAppearance.Color := TBFormMetroTones.Background.BrushColor;



invoking TAdvShapeButtonAppearance.SetColor(const Value: TColor)



line 4315 calling UpdateButtonColor(FColor);



line 4566:

    if Assigned(FOwner.FMetroAppearance) then

    begin

      FOwner.FMetroAppearance.Free;

      FOwner.FMetroAppearance := nil;

    end;



Bingo! We freed and nil FMetroAppearance object, created at line 2079



next we return to SetColor and return to SwitchMetro to line 2086 and see



    FMetroAppearance.ColorTo := clNone;



but FMetroAppearance is freed and nil at line 4655 and AV fired



With best regards, Alexander

steps to reproduce:



application has AdvShapeButton



1. App started in RDP session (host is windows 10 or Server 2016 terminal)

2. close RDP session, app till working

3. reconnect to this RDP session

4. AV fired (App receive "stylechange" message and calling SwithMetro)

Thanks for reporting. We have traced & solved this issue and can confirm the next update will address this.