From fff6e218af12ff36cde66fc3126faca4c2b7e313 Mon Sep 17 00:00:00 2001 From: ivost Date: Fri, 16 Oct 2009 18:12:11 +0000 Subject: [PATCH] * readded BeforeDestructor that calls Destroying (delphi compatibility issue) * uncommented code in Notification procedure (delphi compatibility issue) git-svn-id: trunk@13874 - --- rtl/objpas/classes/classesh.inc | 1 + rtl/objpas/classes/compon.inc | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/rtl/objpas/classes/classesh.inc b/rtl/objpas/classes/classesh.inc index 52ee8ed072..737eff3089 100644 --- a/rtl/objpas/classes/classesh.inc +++ b/rtl/objpas/classes/classesh.inc @@ -1557,6 +1557,7 @@ type procedure WriteState(Writer: TWriter); virtual; constructor Create(AOwner: TComponent); virtual; destructor Destroy; override; + procedure BeforeDestruction; override; procedure DestroyComponents; procedure Destroying; function ExecuteAction(Action: TBasicAction): Boolean; dynamic; diff --git a/rtl/objpas/classes/compon.inc b/rtl/objpas/classes/compon.inc index 2dc0415ea5..63509588cb 100644 --- a/rtl/objpas/classes/compon.inc +++ b/rtl/objpas/classes/compon.inc @@ -237,7 +237,7 @@ end; Procedure TComponent.Notification(AComponent: TComponent; Operation: TOperation); -//Var Runner : Longint; +Var Runner : Longint; begin If (Operation=opRemove) and Assigned(FFreeNotifies) then @@ -250,11 +250,9 @@ begin Exclude(FComponentState, csFreeNotification); end; end; -{ disabled this code: do we really have to notify the child components also? Each observer - should register itself to it's subject! } - {If assigned(FComponents) then + If assigned(FComponents) then For Runner:=0 To FComponents.Count-1 do - TComponent(FComponents.Items[Runner]).Notification(AComponent,Operation);} + TComponent(FComponents.Items[Runner]).Notification(AComponent,Operation); end; @@ -411,13 +409,20 @@ begin end; +Procedure TComponent.BeforeDestruction; + +begin + Destroying; + inherited BeforeDestruction; +end; + + Destructor TComponent.Destroy; Var I : Integer; L : TList; begin - Destroying; If Assigned(FFreeNotifies) then begin L := FFreeNotifies;