mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 01:49:11 +02:00
pastojs: fixed mem leaks
git-svn-id: trunk@39459 -
This commit is contained in:
parent
1a9c7021e4
commit
14af86bd1c
@ -14433,7 +14433,7 @@ begin
|
|||||||
|
|
||||||
// set ancestor
|
// set ancestor
|
||||||
aClass.AncestorType := DestType;
|
aClass.AncestorType := DestType;
|
||||||
{$IFDEF CheckPasTreeRefCount}DestType.ChangeRefId('TPasAliasType.DestType','TPasClassType.AncestorType');{$ENDIF}
|
{$IFDEF CheckPasTreeRefCount}DestType.ChangeRefId('ResolveTypeReference','TPasClassType.AncestorType');{$ENDIF}
|
||||||
FinishScope(stAncestors,aClass);
|
FinishScope(stAncestors,aClass);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -776,6 +776,8 @@ begin
|
|||||||
FreeAndNil(FScanner);
|
FreeAndNil(FScanner);
|
||||||
FreeAndNil(FFileResolver);
|
FreeAndNil(FFileResolver);
|
||||||
FreeAndNil(FPasResolver);
|
FreeAndNil(FPasResolver);
|
||||||
|
if FPasModule<>nil then
|
||||||
|
FPasModule.ReleaseUsedUnits;
|
||||||
ReleaseAndNil(TPasElement(FPasModule){$IFDEF CheckPasTreeRefCount},'CreateElement'{$ENDIF});
|
ReleaseAndNil(TPasElement(FPasModule){$IFDEF CheckPasTreeRefCount},'CreateElement'{$ENDIF});
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
@ -4398,10 +4398,7 @@ var
|
|||||||
Scope: TPasPropertyScope absolute Data;
|
Scope: TPasPropertyScope absolute Data;
|
||||||
begin
|
begin
|
||||||
if RefEl is TPasProperty then
|
if RefEl is TPasProperty then
|
||||||
begin
|
Scope.AncestorProp:=TPasProperty(RefEl)
|
||||||
Scope.AncestorProp:=TPasProperty(RefEl);
|
|
||||||
RefEl.AddRef{$IFDEF CheckPasTreeRefCount}('TPasPropertyScope.AncestorProp'){$ENDIF};
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
RaiseMsg(20180213214723,Scope.Element,GetObjName(RefEl));
|
RaiseMsg(20180213214723,Scope.Element,GetObjName(RefEl));
|
||||||
end;
|
end;
|
||||||
|
@ -1137,7 +1137,7 @@ end;
|
|||||||
procedure TCustomTestModule.SetUp;
|
procedure TCustomTestModule.SetUp;
|
||||||
begin
|
begin
|
||||||
{$IFDEF EnablePasTreeGlobalRefCount}
|
{$IFDEF EnablePasTreeGlobalRefCount}
|
||||||
FElementRefCountAtSetup:=FModule.GlobalRefCount;
|
FElementRefCountAtSetup:=TPasElement.GlobalRefCount;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
inherited SetUp;
|
inherited SetUp;
|
||||||
FSkipTests:=false;
|
FSkipTests:=false;
|
||||||
@ -1246,7 +1246,7 @@ begin
|
|||||||
El:=El.NextRefEl;
|
El:=El.NextRefEl;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
//Halt;
|
Halt;
|
||||||
Fail('TCustomTestModule.TearDown Was='+IntToStr(FElementRefCountAtSetup)+' Now='+IntToStr(TPasElement.GlobalRefCount));
|
Fail('TCustomTestModule.TearDown Was='+IntToStr(FElementRefCountAtSetup)+' Now='+IntToStr(TPasElement.GlobalRefCount));
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
@ -27,7 +27,8 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, contnrs,
|
Classes, SysUtils, contnrs,
|
||||||
fpcunit, testregistry,
|
fpcunit, testregistry,
|
||||||
PScanner, Pas2jsFileUtils, Pas2jsCompiler, Pas2jsFileCache, Pas2jsLogger,
|
PScanner, PasTree, PasResolveEval,
|
||||||
|
Pas2jsFileUtils, Pas2jsCompiler, Pas2jsFileCache, Pas2jsLogger,
|
||||||
tcmodules;
|
tcmodules;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -84,6 +85,9 @@ type
|
|||||||
FFiles: TObjectList; // list of TCLIFile
|
FFiles: TObjectList; // list of TCLIFile
|
||||||
FLogMsgs: TObjectList; // list ot TCLILogMsg
|
FLogMsgs: TObjectList; // list ot TCLILogMsg
|
||||||
FParams: TStringList;
|
FParams: TStringList;
|
||||||
|
{$IFDEF EnablePasTreeGlobalRefCount}
|
||||||
|
FElementRefCountAtSetup: int64;
|
||||||
|
{$ENDIF}
|
||||||
function GetExitCode: integer;
|
function GetExitCode: integer;
|
||||||
function GetFiles(Index: integer): TCLIFile;
|
function GetFiles(Index: integer): TCLIFile;
|
||||||
function GetLogMsgs(Index: integer): TCLILogMsg;
|
function GetLogMsgs(Index: integer): TCLILogMsg;
|
||||||
@ -211,6 +215,9 @@ end;
|
|||||||
|
|
||||||
procedure TCustomTestCLI.SetUp;
|
procedure TCustomTestCLI.SetUp;
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF EnablePasTreeGlobalRefCount}
|
||||||
|
FElementRefCountAtSetup:=TPasElement.GlobalRefCount;
|
||||||
|
{$ENDIF}
|
||||||
inherited SetUp;
|
inherited SetUp;
|
||||||
FDefaultFileAge:=DateTimeToFileDate(Now);
|
FDefaultFileAge:=DateTimeToFileDate(Now);
|
||||||
{$IFDEF Windows}
|
{$IFDEF Windows}
|
||||||
@ -228,6 +235,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomTestCLI.TearDown;
|
procedure TCustomTestCLI.TearDown;
|
||||||
|
{$IFDEF CheckPasTreeRefCount}
|
||||||
|
var
|
||||||
|
El: TPasElement;
|
||||||
|
i: integer;
|
||||||
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FCompiler);
|
FreeAndNil(FCompiler);
|
||||||
FParams.Clear;
|
FParams.Clear;
|
||||||
@ -239,6 +251,24 @@ begin
|
|||||||
FErrorCol:=0;
|
FErrorCol:=0;
|
||||||
FErrorNumber:=0;
|
FErrorNumber:=0;
|
||||||
inherited TearDown;
|
inherited TearDown;
|
||||||
|
{$IFDEF EnablePasTreeGlobalRefCount}
|
||||||
|
if FElementRefCountAtSetup<>TPasElement.GlobalRefCount then
|
||||||
|
begin
|
||||||
|
writeln('TCustomTestCLI.TearDown GlobalRefCount Was='+IntToStr(FElementRefCountAtSetup)+' Now='+IntToStr(TPasElement.GlobalRefCount));
|
||||||
|
{$IFDEF CheckPasTreeRefCount}
|
||||||
|
El:=TPasElement.FirstRefEl;
|
||||||
|
while El<>nil do
|
||||||
|
begin
|
||||||
|
writeln(' ',GetObjName(El),' RefIds.Count=',El.RefIds.Count,':');
|
||||||
|
for i:=0 to El.RefIds.Count-1 do
|
||||||
|
writeln(' ',El.RefIds[i]);
|
||||||
|
El:=El.NextRefEl;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
Halt;
|
||||||
|
Fail('TCustomTestCLI.TearDown Was='+IntToStr(FElementRefCountAtSetup)+' Now='+IntToStr(TPasElement.GlobalRefCount));
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomTestCLI.DoLog(Sender: TObject; const Msg: String);
|
procedure TCustomTestCLI.DoLog(Sender: TObject; const Msg: String);
|
||||||
|
Loading…
Reference in New Issue
Block a user