Jump to content


Photo

A bug in TNxTabSheet.Destroy


  • Please log in to reply
1 reply to this topic

#1 Edwin

Edwin
  • Members
  • 43 posts

Posted 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.

 

 

 



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 09 January 2020 - 08:28 PM

Hi,

 

I can add it. No problem.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users