mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-02 21:38:16 +02:00
Codetools: add debug line in TFindDeclarationParams to indicate a potential memory leak.
git-svn-id: trunk@33431 -
This commit is contained in:
parent
c4bc1cac01
commit
8a0c538440
@ -485,6 +485,7 @@ type
|
||||
FirstFoundProc: PFoundProc;//list of all saved PFoundProc
|
||||
LastFoundProc: PFoundProc;
|
||||
FExtractedOperand: string;
|
||||
procedure ClearFoundProc;
|
||||
procedure FreeFoundProc(aFoundProc: PFoundProc; FreeNext: boolean);
|
||||
procedure RemoveFoundProcFromList(aFoundProc: PFoundProc);
|
||||
public
|
||||
@ -519,6 +520,7 @@ type
|
||||
procedure SetResult(NodeCacheEntry: PCodeTreeNodeCacheEntry);
|
||||
procedure SetIdentifier(NewIdentifierTool: TFindDeclarationTool;
|
||||
NewIdentifier: PChar; NewOnIdentifierFound: TOnIdentifierFound);
|
||||
private
|
||||
procedure SetFirstFoundProc(const ProcContext: TFindContext);
|
||||
procedure SetGenericParamValues(SpecializeParamsTool: TFindDeclarationTool;
|
||||
SpecializeNode: TCodeTreeNode);
|
||||
@ -533,7 +535,6 @@ type
|
||||
procedure ConvertResultCleanPosToCaretPos;
|
||||
procedure ClearResult(CopyCacheFlags: boolean);
|
||||
procedure ClearInput;
|
||||
procedure ClearFoundProc;
|
||||
procedure WriteDebugReport;
|
||||
end;
|
||||
|
||||
@ -10560,8 +10561,23 @@ end;
|
||||
|
||||
{ TFindDeclarationParams }
|
||||
|
||||
procedure TFindDeclarationParams.FreeFoundProc(aFoundProc: PFoundProc;
|
||||
FreeNext: boolean);
|
||||
procedure TFindDeclarationParams.ClearFoundProc;
|
||||
begin
|
||||
if FoundProc=nil then exit;
|
||||
//DebugLn(['TFindDeclarationParams.ClearFoundProc ',dbgs(FoundProc),' Saved=',FoundProc^.Owner<>nil]);
|
||||
if FoundProc^.Owner=nil then
|
||||
// the FoundProc is not saved
|
||||
FreeFoundProc(FoundProc,true)
|
||||
else if FoundProc^.Next<>nil then
|
||||
// the FoundProc is saved (release the later FoundProcs,
|
||||
// which are not needed any more)
|
||||
FreeFoundProc(FoundProc^.Next,true)
|
||||
else
|
||||
DebugLn(['TFindDeclarationParams.ClearFoundProc ',dbgs(FoundProc),' Potential memory leak created here! Build with -gh.']);
|
||||
FoundProc:=nil;
|
||||
end;
|
||||
|
||||
procedure TFindDeclarationParams.FreeFoundProc(aFoundProc: PFoundProc; FreeNext: boolean);
|
||||
var
|
||||
Next: PFoundProc;
|
||||
begin
|
||||
@ -10741,20 +10757,6 @@ begin
|
||||
IdentifierTool:=nil;
|
||||
end;
|
||||
|
||||
procedure TFindDeclarationParams.ClearFoundProc;
|
||||
begin
|
||||
if FoundProc=nil then exit;
|
||||
//DebugLn(['TFindDeclarationParams.ClearFoundProc ',dbgs(FoundProc),' Saved=',FoundProc^.Owner<>nil]);
|
||||
if FoundProc^.Owner=nil then
|
||||
// the FoundProc is not saved
|
||||
FreeFoundProc(FoundProc,true)
|
||||
else if FoundProc^.Next<>nil then
|
||||
// the FoundProc is saved (release the later FoundProcs,
|
||||
// which are not needed any more)
|
||||
FreeFoundProc(FoundProc^.Next,true);
|
||||
FoundProc:=nil;
|
||||
end;
|
||||
|
||||
procedure TFindDeclarationParams.WriteDebugReport;
|
||||
begin
|
||||
DebugLn('TFindDeclarationParams.WriteDebugReport Self=',DbgS(Self));
|
||||
|
Loading…
Reference in New Issue
Block a user