Jump to content


Edwin

Member Since 26 Oct 2007
Offline Last Active Feb 08 2022 06:57 PM
-----

Topics I've Started

A bug in TNxTabSheet.Destroy

09 January 2020 - 01:50 PM

The original TNxTabSheet.Destroy code:

destructor TNxTabSheet.Destroy;
begin
  FreeAndNil(FGlyph);
  FreeAndNil(FTabFont);
  FPageControl.RemovePage(Self);
  inherited;
end;

The fix:

destructor TNxTabSheet.Destroy;
begin
  FreeAndNil(FGlyph);
  FreeAndNil(FTabFont);
  if FPageControl <> nil then // Edwin: 2020-01-09
    FPageControl.RemovePage(Self);
  inherited;
end;

The the issue exists?

You create a new tab at runtime like this:

1 - call TNxTabSheet.Create(aOwner);
2 - then call TNxPageControl.AddPage

In case there is an exception happened in between step 1 and 2, when aOwner trying to free the TNxTabSheet, Access Violation will happen.

 

Please apply the fix to the library. Thanks.