LCL: TNoteBook: Fixed TNotebook fires OnBeforeShow for destroying pages. Issue #32863. Patch by Rik van Kekem

git-svn-id: trunk@56811 -
This commit is contained in:
michl 2017-12-20 21:53:01 +00:00
parent 2c51aaf235
commit 41f5452879

View File

@ -33,7 +33,8 @@ begin
end; end;
//if old and new parent is a TNotebook then remove the page from the old one //if old and new parent is a TNotebook then remove the page from the old one
if (OldParent <> nil) and (OldParent is TNotebook) then if (OldParent <> nil) and (OldParent is TNotebook) and
not (csDestroying in OldParent.ComponentState) then
begin begin
// remove from old pagelist // remove from old pagelist
ParentNotebook := TNotebook(OldParent); ParentNotebook := TNotebook(OldParent);
@ -63,7 +64,8 @@ begin
DebugLn('[TPage.Destroy]'); DebugLn('[TPage.Destroy]');
{$endif} {$endif}
if (Parent <> nil) and (Parent is TNotebook) then if (Parent <> nil) and (Parent is TNotebook) and
not (csDestroying in Parent.ComponentState) then
begin begin
{$ifdef DEBUG_NEW_NOTEBOOK} {$ifdef DEBUG_NEW_NOTEBOOK}
DebugLn('[TPage.Destroy] FPages.Remove(Self)'); DebugLn('[TPage.Destroy] FPages.Remove(Self)');