improved freeing TSynCompletion from Burkhard Carstens

git-svn-id: trunk@9425 -
This commit is contained in:
mattias 2006-06-12 19:22:35 +00:00
parent 3e00d7d57f
commit a7f0807084

View File

@ -1324,8 +1324,9 @@ procedure TSynCompletion.Notification(AComponent: TComponent;
Operation: TOperation); Operation: TOperation);
begin begin
inherited Notification(AComponent, Operation); inherited Notification(AComponent, Operation);
if (Operation = opRemove) and (fEditors.IndexOf(AComponent) > -1) then if (Operation = opRemove) and (fEditors <> nil) then
RemoveEditor(AComponent as TCustomSynEdit); if (fEditors.IndexOf(AComponent) > -1) then
RemoveEditor(AComponent as TCustomSynEdit);
end; end;
constructor TSynCompletion.Create(AOwner: TComponent); constructor TSynCompletion.Create(AOwner: TComponent);
@ -1436,8 +1437,8 @@ begin
Form := nil; Form := nil;
while fEditors.Count <> 0 do while fEditors.Count <> 0 do
RemoveEditor(TCustomSynEdit(fEditors.last)); RemoveEditor(TCustomSynEdit(fEditors.last));
fEditors.Free; FreeAndNil(fEditors);
fEditstuffs.free; FreeAndNil(fEditstuffs);
inherited; inherited;
end; end;
@ -1545,9 +1546,9 @@ begin
{$ELSE} {$ELSE}
RemoveEditor(feditors.last); RemoveEditor(feditors.last);
{$ENDIF} {$ENDIF}
fEditors.free; FreeAndNil(fEditors);
fEditstuffs.free; FreeAndNil(fEditstuffs);
fAutoCompleteList.free; FreeAndNil(fAutoCompleteList);
inherited; inherited;
end; end;
@ -1676,8 +1677,9 @@ end;
procedure TSynAutoComplete.Notification(AComponent: TComponent; Operation: TOperation); procedure TSynAutoComplete.Notification(AComponent: TComponent; Operation: TOperation);
begin begin
inherited Notification(AComponent, Operation); inherited Notification(AComponent, Operation);
if (Operation = opRemove) and (fEditors.indexOf(AComponent) <> -1) then if (Operation = opRemove) and (fEditors <> nil) then
RemoveEditor(AComponent as TCustomSynEdit); if fEditors.indexOf(AComponent) <> -1 then
RemoveEditor(AComponent as TCustomSynEdit);
end; end;
function TSynAutoComplete.RemoveEditor(aEditor: TCustomSynEdit): boolean; function TSynAutoComplete.RemoveEditor(aEditor: TCustomSynEdit): boolean;