mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 16:55:55 +02:00
IDE: designer: fixed mem leak
git-svn-id: trunk@16062 -
This commit is contained in:
parent
6ae9cd0b5c
commit
7ea9854894
@ -2092,22 +2092,21 @@ procedure TDesigner.Notification(AComponent: TComponent; Operation: TOperation);
|
|||||||
Begin
|
Begin
|
||||||
if Operation = opInsert then begin
|
if Operation = opInsert then begin
|
||||||
{$IFDEF VerboseDesigner}
|
{$IFDEF VerboseDesigner}
|
||||||
DebugLn('opInsert ',AComponent.Name,':',AComponent.ClassName,' ',DbgS(AComponent));
|
DebugLn('opInsert ',dbgsName(AComponent),' ',DbgS(AComponent));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if dfDeleting in FFlags then begin
|
if dfDeleting in FFlags then begin
|
||||||
// a component has auto created a new component during deletion
|
// a component has auto created a new component during deletion
|
||||||
// -> ignore the new component
|
// -> ignore the new component
|
||||||
IgnoreDeletingPersistent.Add(AComponent);
|
IgnoreDeletingPersistent.Add(AComponent);
|
||||||
end else begin
|
end else begin
|
||||||
if TheFormEditor<>nil then
|
if (TheFormEditor<>nil) then
|
||||||
TheFormEditor.CreateComponentInterface(AComponent,false);
|
TheFormEditor.CreateComponentInterface(AComponent,false);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if Operation = opRemove then begin
|
if Operation = opRemove then begin
|
||||||
{$IFDEF VerboseDesigner}
|
{$IFDEF VerboseDesigner}
|
||||||
DebugLn('[TDesigner.Notification] opRemove ',
|
DebugLn('[TDesigner.Notification] opRemove ',dbgsName(AComponent));
|
||||||
AComponent.Name,':',AComponent.ClassName);
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
DoDeletePersistent(AComponent,false);
|
DoDeletePersistent(AComponent,false);
|
||||||
end;
|
end;
|
||||||
|
@ -77,7 +77,6 @@ each control that's dropped onto the form
|
|||||||
Function GetPPropInfoByIndex(Index : Integer) : PPropInfo;
|
Function GetPPropInfoByIndex(Index : Integer) : PPropInfo;
|
||||||
Function GetPPropInfoByName(Name : ShortString) : PPropInfo;
|
Function GetPPropInfoByName(Name : ShortString) : PPropInfo;
|
||||||
public
|
public
|
||||||
constructor Create;
|
|
||||||
constructor Create(AComponent: TComponent);
|
constructor Create(AComponent: TComponent);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
@ -436,11 +435,6 @@ end;
|
|||||||
|
|
||||||
{ TComponentInterface }
|
{ TComponentInterface }
|
||||||
|
|
||||||
constructor TComponentInterface.Create;
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TComponentInterface.Create(AComponent: TComponent);
|
constructor TComponentInterface.Create(AComponent: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
@ -936,6 +930,8 @@ Begin
|
|||||||
{$IFDEF IDE_DEBUG}
|
{$IFDEF IDE_DEBUG}
|
||||||
DebugLn(['TCustomFormEditor.DeleteComponent ',DbgSName(AComponent),' IsJITComponent=',IsJITComponent(AComponent),' FreeComponent=',FreeComponent]);
|
DebugLn(['TCustomFormEditor.DeleteComponent ',DbgSName(AComponent),' IsJITComponent=',IsJITComponent(AComponent),' FreeComponent=',FreeComponent]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
if PropertyEditorHook.LookupRoot=AComponent then
|
||||||
|
PropertyEditorHook.LookupRoot:=nil;
|
||||||
IsJIT:=IsJITComponent(AComponent);
|
IsJIT:=IsJITComponent(AComponent);
|
||||||
if IsJIT or (csInline in AComponent.ComponentState) then begin
|
if IsJIT or (csInline in AComponent.ComponentState) then begin
|
||||||
i:=AComponent.ComponentCount-1;
|
i:=AComponent.ComponentCount-1;
|
||||||
@ -946,8 +942,6 @@ Begin
|
|||||||
i:=AComponent.ComponentCount-1;
|
i:=AComponent.ComponentCount-1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if PropertyEditorHook.LookupRoot=AComponent then
|
|
||||||
PropertyEditorHook.LookupRoot:=nil;
|
|
||||||
if IsJITComponent(AComponent) then begin
|
if IsJITComponent(AComponent) then begin
|
||||||
// value is a top level component
|
// value is a top level component
|
||||||
if JITFormList.IsJITForm(AComponent) then begin
|
if JITFormList.IsJITForm(AComponent) then begin
|
||||||
@ -1566,8 +1560,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// create component interface
|
// create component interface
|
||||||
Temp := TComponentInterface.Create(NewComponent);
|
Temp:=TComponentInterface(CreateComponentInterface(NewComponent,false));
|
||||||
|
|
||||||
// calc parent
|
// calc parent
|
||||||
AParent:=nil;
|
AParent:=nil;
|
||||||
if ParentComponent is TControl then begin
|
if ParentComponent is TControl then begin
|
||||||
@ -1596,7 +1590,7 @@ begin
|
|||||||
NewJITIndex := JITList.AddNewJITComponent(NewUnitName,TypeClass);
|
NewJITIndex := JITList.AddNewJITComponent(NewUnitName,TypeClass);
|
||||||
if NewJITIndex >= 0 then
|
if NewJITIndex >= 0 then
|
||||||
// create component interface
|
// create component interface
|
||||||
Temp := TComponentInterface.Create(JITList[NewJITIndex])
|
Temp := TComponentInterface(CreateComponentInterface(JITList[NewJITIndex],false))
|
||||||
else
|
else
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -1700,7 +1694,9 @@ begin
|
|||||||
|
|
||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TCustomFormEditor.CreateComponent F ');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TCustomFormEditor.CreateComponent F ');{$ENDIF}
|
||||||
// add to component list
|
// add to component list
|
||||||
FComponentInterfaces.Add(Temp);
|
DebugLn(['TCustomFormEditor.CreateComponent ',dbgsName(Temp.Component),' ',FindComponent(Temp.Component)<>nil]);
|
||||||
|
if FindComponent(Temp.Component)=nil then
|
||||||
|
FComponentInterfaces.Add(Temp);
|
||||||
|
|
||||||
if Temp.Component.Owner<>nil then
|
if Temp.Component.Owner<>nil then
|
||||||
CreateChildComponentInterfaces(Temp.Component.Owner);
|
CreateChildComponentInterfaces(Temp.Component.Owner);
|
||||||
|
Loading…
Reference in New Issue
Block a user