Page 1 of 1

OnDestroy order inside SRVTabSet.pas

Posted: Fri May 24, 2019 11:20 pm
by Romeo_Popescu
Hi Sergey,

I started using EurekaLog to track down exceptions and found that on program close there is an issue inside SRVTabSet.pas

I think that in this code:

destructor TSRVTabSet.Destroy;
begin
FTabs.Free;
FCloseButton.Free;
FMargins.Free;
Buffer.Free;
SkinManager := nil;
ImageList := nil;
inherited;
end;

FTabs is freed first but at some point after that GetShowTabCount is called and causes an exception.

I changed it to:

destructor TSRVTabSet.Destroy;
begin
FCloseButton.Free;
FMargins.Free;
Buffer.Free;
SkinManager := nil;
ImageList := nil;
FTabs.Free; // moved here
inherited;
end;

and the issue is now gone.
Maybe I am wrong but you may want to have a look.

All the best,
Romeo

Re: OnDestroy order inside SRVTabSet.pas

Posted: Sat May 25, 2019 6:59 am
by Sergey Tkachenko
Yes, this is a bug, move ImageList := nil; to the beginning of the destructor.