mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-12 19:16:16 +02:00
fixed memleak
git-svn-id: trunk@8085 -
This commit is contained in:
parent
79df78d87f
commit
205ee1a4fd
@ -377,9 +377,9 @@ type
|
|||||||
fActiveEditorIndexAtStart: integer;
|
fActiveEditorIndexAtStart: integer;
|
||||||
FAutoCreateForms: boolean;
|
FAutoCreateForms: boolean;
|
||||||
FAutoOpenDesignerFormsDisabled: boolean;
|
FAutoOpenDesignerFormsDisabled: boolean;
|
||||||
fBookmarks: TProjectBookmarkList;
|
FBookmarks: TProjectBookmarkList;
|
||||||
fChanged: boolean;
|
fChanged: boolean;
|
||||||
fCompilerOptions: TProjectCompilerOptions;
|
FCompilerOptions: TProjectCompilerOptions;
|
||||||
FDefineTemplates: TProjectDefineTemplates;
|
FDefineTemplates: TProjectDefineTemplates;
|
||||||
|
|
||||||
FFirstRemovedDependency: TPkgDependency;
|
FFirstRemovedDependency: TPkgDependency;
|
||||||
@ -388,7 +388,7 @@ type
|
|||||||
|
|
||||||
fDestroying: boolean;
|
fDestroying: boolean;
|
||||||
fIconPath: String;
|
fIconPath: String;
|
||||||
fJumpHistory: TProjectJumpHistory;
|
FJumpHistory: TProjectJumpHistory;
|
||||||
fLastReadLPIFileDate: TDateTime;
|
fLastReadLPIFileDate: TDateTime;
|
||||||
fLastReadLPIFilename: string;
|
fLastReadLPIFilename: string;
|
||||||
fMainUnitID: Integer;
|
fMainUnitID: Integer;
|
||||||
@ -402,11 +402,11 @@ type
|
|||||||
fProjectDirectory: string;
|
fProjectDirectory: string;
|
||||||
fProjectInfoFile: String; // the lpi filename
|
fProjectInfoFile: String; // the lpi filename
|
||||||
//fProjectType: TProjectType;
|
//fProjectType: TProjectType;
|
||||||
fPublishOptions: TPublishProjectOptions;
|
FPublishOptions: TPublishProjectOptions;
|
||||||
fRunParameterOptions: TRunParamsOptions;
|
FRunParameterOptions: TRunParamsOptions;
|
||||||
FSourceDirectories: TFileReferenceList;
|
FSourceDirectories: TFileReferenceList;
|
||||||
fTargetFileExt: String;
|
FTargetFileExt: String;
|
||||||
fUnitList: TList; // list of _all_ units (TUnitInfo)
|
FUnitList: TList; // list of _all_ units (TUnitInfo)
|
||||||
FUpdateLock: integer;
|
FUpdateLock: integer;
|
||||||
function GetFirstAutoRevertLockedUnit: TUnitInfo;
|
function GetFirstAutoRevertLockedUnit: TUnitInfo;
|
||||||
function GetFirstLoadedUnit: TUnitInfo;
|
function GetFirstLoadedUnit: TUnitInfo;
|
||||||
@ -565,9 +565,9 @@ type
|
|||||||
property AutoOpenDesignerFormsDisabled: boolean
|
property AutoOpenDesignerFormsDisabled: boolean
|
||||||
read FAutoOpenDesignerFormsDisabled
|
read FAutoOpenDesignerFormsDisabled
|
||||||
write SetAutoOpenDesignerFormsDisabled;
|
write SetAutoOpenDesignerFormsDisabled;
|
||||||
property Bookmarks: TProjectBookmarkList read fBookmarks write fBookmarks;
|
property Bookmarks: TProjectBookmarkList read FBookmarks write FBookmarks;
|
||||||
property CompilerOptions: TProjectCompilerOptions
|
property CompilerOptions: TProjectCompilerOptions
|
||||||
read fCompilerOptions write SetCompilerOptions;
|
read FCompilerOptions write SetCompilerOptions;
|
||||||
property DefineTemplates: TProjectDefineTemplates read FDefineTemplates;
|
property DefineTemplates: TProjectDefineTemplates read FDefineTemplates;
|
||||||
property Destroying: boolean read fDestroying;
|
property Destroying: boolean read fDestroying;
|
||||||
property FirstAutoRevertLockedUnit: TUnitInfo read GetFirstAutoRevertLockedUnit;
|
property FirstAutoRevertLockedUnit: TUnitInfo read GetFirstAutoRevertLockedUnit;
|
||||||
@ -581,7 +581,7 @@ type
|
|||||||
property FirstUnitWithComponent: TUnitInfo read GetFirstUnitWithComponent;
|
property FirstUnitWithComponent: TUnitInfo read GetFirstUnitWithComponent;
|
||||||
property IconPath: String read fIconPath write fIconPath;
|
property IconPath: String read fIconPath write fIconPath;
|
||||||
property JumpHistory: TProjectJumpHistory
|
property JumpHistory: TProjectJumpHistory
|
||||||
read fJumpHistory write fJumpHistory;
|
read FJumpHistory write FJumpHistory;
|
||||||
property MainFilename: String read GetMainFilename;
|
property MainFilename: String read GetMainFilename;
|
||||||
property MainUnitID: Integer read FMainUnitID write SetMainUnitID;
|
property MainUnitID: Integer read FMainUnitID write SetMainUnitID;
|
||||||
property MainUnitInfo: TUnitInfo read GetMainUnitInfo;
|
property MainUnitInfo: TUnitInfo read GetMainUnitInfo;
|
||||||
@ -596,10 +596,10 @@ type
|
|||||||
property ProjectInfoFile: string
|
property ProjectInfoFile: string
|
||||||
read GetProjectInfoFile write SetProjectInfoFile;
|
read GetProjectInfoFile write SetProjectInfoFile;
|
||||||
property PublishOptions: TPublishProjectOptions
|
property PublishOptions: TPublishProjectOptions
|
||||||
read fPublishOptions write fPublishOptions;
|
read FPublishOptions write FPublishOptions;
|
||||||
property RunParameterOptions: TRunParamsOptions read fRunParameterOptions;
|
property RunParameterOptions: TRunParamsOptions read FRunParameterOptions;
|
||||||
property SourceDirectories: TFileReferenceList read FSourceDirectories;
|
property SourceDirectories: TFileReferenceList read FSourceDirectories;
|
||||||
property TargetFileExt: String read fTargetFileExt write fTargetFileExt;
|
property TargetFileExt: String read FTargetFileExt write FTargetFileExt;
|
||||||
property TargetFilename: string
|
property TargetFilename: string
|
||||||
read GetTargetFilename write SetTargetFilename;
|
read GetTargetFilename write SetTargetFilename;
|
||||||
property Units[Index: integer]: TUnitInfo read GetUnits write SetUnits;
|
property Units[Index: integer]: TUnitInfo read GetUnits write SetUnits;
|
||||||
@ -1250,14 +1250,14 @@ begin
|
|||||||
|
|
||||||
fActiveEditorIndexAtStart := -1;
|
fActiveEditorIndexAtStart := -1;
|
||||||
FAutoCreateForms := true;
|
FAutoCreateForms := true;
|
||||||
fBookmarks := TProjectBookmarkList.Create;
|
FBookmarks := TProjectBookmarkList.Create;
|
||||||
CompilerOptions := TProjectCompilerOptions.Create(Self);
|
CompilerOptions := TProjectCompilerOptions.Create(Self);
|
||||||
FDefineTemplates:=TProjectDefineTemplates.Create(Self);
|
FDefineTemplates:=TProjectDefineTemplates.Create(Self);
|
||||||
FFlags:=DefaultProjectFlags;
|
FFlags:=DefaultProjectFlags;
|
||||||
fIconPath := '';
|
fIconPath := '';
|
||||||
fJumpHistory:=TProjectJumpHistory.Create;
|
FJumpHistory:=TProjectJumpHistory.Create;
|
||||||
fJumpHistory.OnCheckPosition:=@JumpHistoryCheckPosition;
|
FJumpHistory.OnCheckPosition:=@JumpHistoryCheckPosition;
|
||||||
fJumpHistory.OnLoadSaveFilename:=@OnLoadSaveFilename;
|
FJumpHistory.OnLoadSaveFilename:=@OnLoadSaveFilename;
|
||||||
fMainUnitID := -1;
|
fMainUnitID := -1;
|
||||||
fModified := false;
|
fModified := false;
|
||||||
fProjectInfoFile := '';
|
fProjectInfoFile := '';
|
||||||
@ -1265,11 +1265,11 @@ begin
|
|||||||
FSourceDirectories.OnChanged:=@SourceDirectoriesChanged;
|
FSourceDirectories.OnChanged:=@SourceDirectoriesChanged;
|
||||||
|
|
||||||
UpdateProjectDirectory;
|
UpdateProjectDirectory;
|
||||||
fPublishOptions:=TPublishProjectOptions.Create(Self);
|
FPublishOptions:=TPublishProjectOptions.Create(Self);
|
||||||
fRunParameterOptions:=TRunParamsOptions.Create;
|
FRunParameterOptions:=TRunParamsOptions.Create;
|
||||||
fTargetFileExt := GetDefaultExecutableExt;
|
FTargetFileExt := GetDefaultExecutableExt;
|
||||||
Title := '';
|
Title := '';
|
||||||
fUnitList := TList.Create; // list of TUnitInfo
|
FUnitList := TList.Create; // list of TUnitInfo
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -1279,12 +1279,13 @@ destructor TProject.Destroy;
|
|||||||
begin
|
begin
|
||||||
fDestroying:=true;
|
fDestroying:=true;
|
||||||
Clear;
|
Clear;
|
||||||
FreeThenNil(fBookmarks);
|
FreeThenNil(FBookmarks);
|
||||||
FreeThenNil(fUnitList);
|
FreeThenNil(FUnitList);
|
||||||
FreeThenNil(fJumpHistory);
|
FreeThenNil(FJumpHistory);
|
||||||
FreeThenNil(fPublishOptions);
|
FreeThenNil(FSourceDirectories);
|
||||||
FreeThenNil(fRunParameterOptions);
|
FreeThenNil(FPublishOptions);
|
||||||
FreeThenNil(fCompilerOptions);
|
FreeThenNil(FRunParameterOptions);
|
||||||
|
FreeThenNil(FCompilerOptions);
|
||||||
FreeThenNil(FDefineTemplates);
|
FreeThenNil(FDefineTemplates);
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
@ -1435,8 +1436,8 @@ begin
|
|||||||
|
|
||||||
if (not (pfSaveOnlyProjectUnits in Flags))
|
if (not (pfSaveOnlyProjectUnits in Flags))
|
||||||
and (not (pwfSkipJumpPoints in ProjectWriteFlags)) then begin
|
and (not (pwfSkipJumpPoints in ProjectWriteFlags)) then begin
|
||||||
fJumpHistory.DeleteInvalidPositions;
|
FJumpHistory.DeleteInvalidPositions;
|
||||||
fJumpHistory.SaveToXMLConfig(xmlconfig,Path);
|
FJumpHistory.SaveToXMLConfig(xmlconfig,Path);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if Assigned(OnSaveProjectInfo) then
|
if Assigned(OnSaveProjectInfo) then
|
||||||
@ -1635,7 +1636,7 @@ begin
|
|||||||
// load session info
|
// load session info
|
||||||
ActiveEditorIndexAtStart := xmlconfig.GetValue(
|
ActiveEditorIndexAtStart := xmlconfig.GetValue(
|
||||||
Path+'General/ActiveEditorIndexAtStart/Value', -1);
|
Path+'General/ActiveEditorIndexAtStart/Value', -1);
|
||||||
fJumpHistory.LoadFromXMLConfig(xmlconfig,Path+'');
|
FJumpHistory.LoadFromXMLConfig(xmlconfig,Path+'');
|
||||||
|
|
||||||
if Assigned(OnLoadProjectInfo) then OnLoadProjectInfo(Self,XMLConfig);
|
if Assigned(OnLoadProjectInfo) then OnLoadProjectInfo(Self,XMLConfig);
|
||||||
|
|
||||||
@ -1672,7 +1673,7 @@ begin
|
|||||||
//debugln('TProject.AddUnit A ',AnUnit.Filename,' AddToProjectFile=',dbgs(AddToProjectFile));
|
//debugln('TProject.AddUnit A ',AnUnit.Filename,' AddToProjectFile=',dbgs(AddToProjectFile));
|
||||||
BeginUpdate(true);
|
BeginUpdate(true);
|
||||||
NewIndex:=UnitCount;
|
NewIndex:=UnitCount;
|
||||||
fUnitList.Add(AnUnit);
|
FUnitList.Add(AnUnit);
|
||||||
AnUnit.Project:=Self;
|
AnUnit.Project:=Self;
|
||||||
AnUnit.OnFileBackup:=@OnUnitFileBackup;
|
AnUnit.OnFileBackup:=@OnUnitFileBackup;
|
||||||
AnUnit.OnLoadSaveFilename:=@OnLoadSaveFilename;
|
AnUnit.OnLoadSaveFilename:=@OnLoadSaveFilename;
|
||||||
@ -1736,7 +1737,7 @@ begin
|
|||||||
|
|
||||||
// delete unitinfo instance
|
// delete unitinfo instance
|
||||||
OldUnitInfo.Free;
|
OldUnitInfo.Free;
|
||||||
fUnitList.Delete(Index);
|
FUnitList.Delete(Index);
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1769,24 +1770,24 @@ begin
|
|||||||
|
|
||||||
// delete files
|
// delete files
|
||||||
for i:=0 to UnitCount-1 do Units[i].Free;
|
for i:=0 to UnitCount-1 do Units[i].Free;
|
||||||
fUnitList.Clear;
|
FUnitList.Clear;
|
||||||
|
|
||||||
fRunParameterOptions.Clear;
|
FRunParameterOptions.Clear;
|
||||||
|
|
||||||
fActiveEditorIndexAtStart := -1;
|
fActiveEditorIndexAtStart := -1;
|
||||||
FAutoOpenDesignerFormsDisabled := false;
|
FAutoOpenDesignerFormsDisabled := false;
|
||||||
fBookmarks.Clear;
|
FBookmarks.Clear;
|
||||||
fCompilerOptions.Clear;
|
FCompilerOptions.Clear;
|
||||||
FDefineTemplates.Clear;
|
FDefineTemplates.Clear;
|
||||||
fIconPath := '';
|
fIconPath := '';
|
||||||
fJumpHistory.Clear;
|
FJumpHistory.Clear;
|
||||||
fMainUnitID := -1;
|
fMainUnitID := -1;
|
||||||
fModified := false;
|
fModified := false;
|
||||||
fProjectInfoFile := '';
|
fProjectInfoFile := '';
|
||||||
FSourceDirectories.Clear;
|
FSourceDirectories.Clear;
|
||||||
UpdateProjectDirectory;
|
UpdateProjectDirectory;
|
||||||
fPublishOptions.Clear;
|
FPublishOptions.Clear;
|
||||||
fTargetFileExt := GetDefaultExecutableExt;
|
FTargetFileExt := GetDefaultExecutableExt;
|
||||||
Title := '';
|
Title := '';
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
@ -1814,7 +1815,7 @@ end;
|
|||||||
|
|
||||||
function TProject.GetUnits(Index:integer):TUnitInfo;
|
function TProject.GetUnits(Index:integer):TUnitInfo;
|
||||||
begin
|
begin
|
||||||
Result:=TUnitInfo(fUnitList[Index]);
|
Result:=TUnitInfo(FUnitList[Index]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProject.SetFlags(const AValue: TProjectFlags);
|
procedure TProject.SetFlags(const AValue: TProjectFlags);
|
||||||
@ -1851,8 +1852,8 @@ end;
|
|||||||
|
|
||||||
procedure TProject.SetUnits(Index:integer; AUnitInfo: TUnitInfo);
|
procedure TProject.SetUnits(Index:integer; AUnitInfo: TUnitInfo);
|
||||||
begin
|
begin
|
||||||
if AUnitInfo<>TUnitInfo(fUnitList[Index]) then begin
|
if AUnitInfo<>TUnitInfo(FUnitList[Index]) then begin
|
||||||
fUnitList[Index]:=AUnitInfo;
|
FUnitList[Index]:=AUnitInfo;
|
||||||
Modified:=true;
|
Modified:=true;
|
||||||
if AUnitInfo<>nil then AUnitInfo.Project:=Self;
|
if AUnitInfo<>nil then AUnitInfo.Project:=Self;
|
||||||
end;
|
end;
|
||||||
@ -1860,7 +1861,7 @@ end;
|
|||||||
|
|
||||||
function TProject.UnitCount:integer;
|
function TProject.UnitCount:integer;
|
||||||
begin
|
begin
|
||||||
Result:=fUnitList.Count;
|
Result:=FUnitList.Count;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProject.GetFileCount: integer;
|
function TProject.GetFileCount: integer;
|
||||||
@ -2271,12 +2272,12 @@ end;
|
|||||||
|
|
||||||
function TProject.GetTargetFilename: string;
|
function TProject.GetTargetFilename: string;
|
||||||
begin
|
begin
|
||||||
Result:=fCompilerOptions.TargetFilename;
|
Result:=FCompilerOptions.TargetFilename;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProject.SetTargetFilename(const NewTargetFilename: string);
|
procedure TProject.SetTargetFilename(const NewTargetFilename: string);
|
||||||
begin
|
begin
|
||||||
fCompilerOptions.TargetFilename:=NewTargetFilename;
|
FCompilerOptions.TargetFilename:=NewTargetFilename;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProject.GetMainFilename: String;
|
function TProject.GetMainFilename: String;
|
||||||
@ -2652,8 +2653,8 @@ end;
|
|||||||
|
|
||||||
procedure TProject.SetCompilerOptions(const AValue: TProjectCompilerOptions);
|
procedure TProject.SetCompilerOptions(const AValue: TProjectCompilerOptions);
|
||||||
begin
|
begin
|
||||||
if fCompilerOptions=AValue then exit;
|
if FCompilerOptions=AValue then exit;
|
||||||
fCompilerOptions:=AValue;
|
FCompilerOptions:=AValue;
|
||||||
inherited SetLazCompilerOptions(AValue);
|
inherited SetLazCompilerOptions(AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2880,7 +2881,7 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
AnUnitInfo: TUnitInfo;
|
AnUnitInfo: TUnitInfo;
|
||||||
begin
|
begin
|
||||||
Cnt:=fUnitList.Count;
|
Cnt:=FUnitList.Count;
|
||||||
for i:=0 to Cnt-1 do begin
|
for i:=0 to Cnt-1 do begin
|
||||||
AnUnitInfo:=Units[i];
|
AnUnitInfo:=Units[i];
|
||||||
AnUnitInfo.FSourceDirectoryReferenced:=false;
|
AnUnitInfo.FSourceDirectoryReferenced:=false;
|
||||||
|
Loading…
Reference in New Issue
Block a user