From 41f545287936cc3f31d443d09a60f656f8da6773 Mon Sep 17 00:00:00 2001 From: michl Date: Wed, 20 Dec 2017 21:53:01 +0000 Subject: [PATCH] LCL: TNoteBook: Fixed TNotebook fires OnBeforeShow for destroying pages. Issue #32863. Patch by Rik van Kekem git-svn-id: trunk@56811 - --- lcl/include/page.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lcl/include/page.inc b/lcl/include/page.inc index e8b5b1bda1..ff370bbb57 100644 --- a/lcl/include/page.inc +++ b/lcl/include/page.inc @@ -33,7 +33,8 @@ begin end; //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 // remove from old pagelist ParentNotebook := TNotebook(OldParent); @@ -63,7 +64,8 @@ begin DebugLn('[TPage.Destroy]'); {$endif} - if (Parent <> nil) and (Parent is TNotebook) then + if (Parent <> nil) and (Parent is TNotebook) and + not (csDestroying in Parent.ComponentState) then begin {$ifdef DEBUG_NEW_NOTEBOOK} DebugLn('[TPage.Destroy] FPages.Remove(Self)');