TNotebook always fires OnBeforeShow for pages when it's destroyed
Original Reporter info from Mantis: rvk
-
Reporter name: Rik van Kekem
Original Reporter info from Mantis: rvk
- Reporter name: Rik van Kekem
Description:
The TNotebook always fires the OnBeforeShow for it's pages when it's destroyed. This behavior was different in Laz 1.6.4.
Also see discussion at
http://forum.lazarus.freepascal.org/index.php/topic,39348.msg269804
Steps to reproduce:
Attached example shows the firing of OnBeforePage for Page2 and Page1 when the program is closed. It's logical because Page 3 is destroyed first and Page2 becomes visible.
But this does not need to happen if TNoteBook itself is destroyed.
Additional information:
In /lcl/include/page.inc there is a destructor TPage.Destroy which introduced this behavior.
Maybe the check for "(Parent <> nil) and (Parent is TNotebook)" could also include that the parent is not in csDestroying state. It it is, it could just remove itself from the FPageList without triggering the OnBeforeShow for the next page (like it was in previous versions).