Skip to content

Commit 424b8e0

Browse files
committed
Removed unneeded TEngineClient.Notification
Simplified TPythonEngine.Notification and fixed FClients related bug.
1 parent 85a2374 commit 424b8e0

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

Source/PythonEngine.pas

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,8 +2032,6 @@ TEngineClient = class(TComponent)
20322032

20332033
procedure SetEngine( val : TPythonEngine ); virtual;
20342034
procedure Loaded; override;
2035-
procedure Notification( AComponent: TComponent;
2036-
Operation: TOperation); override;
20372035
procedure ModuleReady(Sender : TObject); virtual;
20382036
public
20392037
// Constructors & destructors
@@ -4616,24 +4614,10 @@ function TPythonEngine.GetClients( idx : Integer ) : TEngineClient;
46164614

46174615
procedure TPythonEngine.Notification( AComponent: TComponent;
46184616
Operation: TOperation);
4619-
var
4620-
i : Integer;
46214617
begin
46224618
inherited;
4623-
if Operation = opRemove then
4624-
begin
4625-
if AComponent = IO then
4626-
IO := nil
4627-
else
4628-
begin
4629-
for i := 0 to ClientCount - 1 do
4630-
if Clients[i] = AComponent then
4631-
begin
4632-
RemoveClient( Clients[i] );
4633-
Break;
4634-
end;
4635-
end;
4636-
end;
4619+
if (Operation = opRemove) and (AComponent = IO) then
4620+
IO := nil
46374621
end;
46384622

46394623
procedure TPythonEngine.CheckRegistry;
@@ -6410,14 +6394,6 @@ procedure TEngineClient.Loaded;
64106394
FOnCreate( Self );
64116395
end;
64126396

6413-
procedure TEngineClient.Notification( AComponent: TComponent; Operation: TOperation);
6414-
begin
6415-
inherited;
6416-
if Operation = opRemove then
6417-
if AComponent = FEngine then
6418-
FEngine := nil;
6419-
end;
6420-
64216397
procedure TEngineClient.Initialize;
64226398
begin
64236399
if FInitialized then

0 commit comments

Comments
 (0)