mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 11:16:07 +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
|
FirstFoundProc: PFoundProc;//list of all saved PFoundProc
|
||||||
LastFoundProc: PFoundProc;
|
LastFoundProc: PFoundProc;
|
||||||
FExtractedOperand: string;
|
FExtractedOperand: string;
|
||||||
|
procedure ClearFoundProc;
|
||||||
procedure FreeFoundProc(aFoundProc: PFoundProc; FreeNext: boolean);
|
procedure FreeFoundProc(aFoundProc: PFoundProc; FreeNext: boolean);
|
||||||
procedure RemoveFoundProcFromList(aFoundProc: PFoundProc);
|
procedure RemoveFoundProcFromList(aFoundProc: PFoundProc);
|
||||||
public
|
public
|
||||||
@ -519,6 +520,7 @@ type
|
|||||||
procedure SetResult(NodeCacheEntry: PCodeTreeNodeCacheEntry);
|
procedure SetResult(NodeCacheEntry: PCodeTreeNodeCacheEntry);
|
||||||
procedure SetIdentifier(NewIdentifierTool: TFindDeclarationTool;
|
procedure SetIdentifier(NewIdentifierTool: TFindDeclarationTool;
|
||||||
NewIdentifier: PChar; NewOnIdentifierFound: TOnIdentifierFound);
|
NewIdentifier: PChar; NewOnIdentifierFound: TOnIdentifierFound);
|
||||||
|
private
|
||||||
procedure SetFirstFoundProc(const ProcContext: TFindContext);
|
procedure SetFirstFoundProc(const ProcContext: TFindContext);
|
||||||
procedure SetGenericParamValues(SpecializeParamsTool: TFindDeclarationTool;
|
procedure SetGenericParamValues(SpecializeParamsTool: TFindDeclarationTool;
|
||||||
SpecializeNode: TCodeTreeNode);
|
SpecializeNode: TCodeTreeNode);
|
||||||
@ -533,7 +535,6 @@ type
|
|||||||
procedure ConvertResultCleanPosToCaretPos;
|
procedure ConvertResultCleanPosToCaretPos;
|
||||||
procedure ClearResult(CopyCacheFlags: boolean);
|
procedure ClearResult(CopyCacheFlags: boolean);
|
||||||
procedure ClearInput;
|
procedure ClearInput;
|
||||||
procedure ClearFoundProc;
|
|
||||||
procedure WriteDebugReport;
|
procedure WriteDebugReport;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -10560,8 +10561,23 @@ end;
|
|||||||
|
|
||||||
{ TFindDeclarationParams }
|
{ TFindDeclarationParams }
|
||||||
|
|
||||||
procedure TFindDeclarationParams.FreeFoundProc(aFoundProc: PFoundProc;
|
procedure TFindDeclarationParams.ClearFoundProc;
|
||||||
FreeNext: boolean);
|
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
|
var
|
||||||
Next: PFoundProc;
|
Next: PFoundProc;
|
||||||
begin
|
begin
|
||||||
@ -10741,20 +10757,6 @@ begin
|
|||||||
IdentifierTool:=nil;
|
IdentifierTool:=nil;
|
||||||
end;
|
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;
|
procedure TFindDeclarationParams.WriteDebugReport;
|
||||||
begin
|
begin
|
||||||
DebugLn('TFindDeclarationParams.WriteDebugReport Self=',DbgS(Self));
|
DebugLn('TFindDeclarationParams.WriteDebugReport Self=',DbgS(Self));
|
||||||
|
Loading…
Reference in New Issue
Block a user