Jump to content


Photo

PageControl index out of range exception on destroy.


  • Please log in to reply
1 reply to this topic

#1 FourWhey

FourWhey
  • Members
  • 164 posts

Posted 18 January 2023 - 01:21 AM

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

 

The second "FPageControl.RemovePage(Self)" sometimes causes an index out of range exception (-1).

I commented out the one without the check that it's assigned, and it doesn't do it anymore.



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 18 January 2023 - 12:07 PM

Hello,

 

Yes, this is correct. I have already removed it too.

 

Thank you.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.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.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users