MG: fixed mem leaks

git-svn-id: trunk@1587 -
This commit is contained in:
lazarus 2002-04-03 18:20:51 +00:00
parent 8867b319ef
commit 20321075df
3 changed files with 23 additions and 10 deletions

View File

@ -172,7 +172,7 @@ type
constructor Create(const AName, ADescription, AVariable, AValue: string;
AnAction: TDefineAction);
destructor Destroy; override;
function ConsistencyCheck: integer; // 0 = ok
function ConsistencyCheck: integer; // 0 = ok
procedure WriteDebugReport;
end;
@ -2474,6 +2474,7 @@ begin
+';..'+ds+'lcl'+ds+'interfaces'+ds+WidgetType
+';'+SrcPath
,da_DefineRecurse));
MainDir.AddChild(DirTempl);
if MainDir<>nil then begin
Result:=TDefineTemplate.Create(StdDefTemplLazarusSources,

View File

@ -449,8 +449,6 @@ end;
destructor TheFontsInfoManager.Destroy;
var APheSharedFontsInfo:PheSharedFontsInfo;
begin
gFontsInfoManager := nil;
if Assigned(FFontsInfo) then
begin
while FFontsInfo.Count > 0 do
@ -464,6 +462,7 @@ begin
end;
inherited Destroy;
gFontsInfoManager := nil;
end;
procedure TheFontsInfoManager.DestroyFontHandles(
@ -534,12 +533,10 @@ begin
// free all objects
BaseFont.Free;
Dispose(pFontsInfo);
{$IFDEF SYN_LAZARUS}
pFontsInfo:=nil;
{$ENDIF}
end;
end;
{$IFDEF SYN_LAZARUS}
pFontsInfo:=nil;
if SynTextDrawerFinalization and (FFontsInfo.Count=0) then
// the program is in the finalization phase
// and this object is not used anymore -> destroy it
@ -779,7 +776,11 @@ begin
begin
pInfo := GetFontsInfoManager.GetFontsInfo(Value);
if pInfo = FpInfo then begin
GetFontsInfoManager.ReleaseFontsInfo(FpInfo);
{$IFDEF SYN_LAZARUS}
// GetFontsInfo has increased the refcount, but we already have the font
// -> decrease the refcount
{$ENDIF}
GetFontsInfoManager.ReleaseFontsInfo(pInfo);
end else begin
ReleaseFontsInfo;
FpInfo := pInfo;
@ -1303,6 +1304,9 @@ finalization
// So, the flag SynTextDrawerFinalization is set and the gFontsInfoManager
// will destroy itself, as soon, as it is not used anymore.
SynTextDrawerFinalization:=true;
if Assigned(gFontsInfoManager) and (gFontsInfoManager.FFontsInfo.Count=0)
then
FreeAndNil(gFontsInfoManager);
{$ELSE}
FreeAndNil(gFontsInfoManager);
{$ENDIF}

View File

@ -626,6 +626,7 @@ begin
FreeThenNil(MiscellaneousOptions);
FreeThenNil(EditorOpts);
FreeThenNil(EnvironmentOptions);
FreeThenNil(InputHistories);
FreeThenNil(HintTimer1);
FreeThenNil(HintWindow1);
@ -4603,7 +4604,9 @@ var
ACaption,AText:string;
begin
repeat
writeln('[TMainIDE.DoLoadCodeBuffer] A ',AFilename);
{$IFDEF IDE_DEBUG}
writeln('[TMainIDE.DoLoadCodeBuffer] A ',AFilename);
{$ENDIF}
if (lbfCheckIfText in Flags)
and FileExists(AFilename) and (not FileIsText(AFilename))
then begin
@ -4619,7 +4622,9 @@ writeln('[TMainIDE.DoLoadCodeBuffer] A ',AFilename);
lbfRevert in Flags);
if ACodeBuffer<>nil then begin
Result:=mrOk;
writeln('[TMainIDE.DoLoadCodeBuffer] ',ACodeBuffer.SourceLength,' ',ACodeBuffer.Filename);
{$IFDEF IDE_DEBUG}
writeln('[TMainIDE.DoLoadCodeBuffer] ',ACodeBuffer.SourceLength,' ',ACodeBuffer.Filename);
{$ENDIF}
end else begin
ACaption:='Read Error';
AText:='Unable to read file "'+AFilename+'"!';
@ -5198,7 +5203,7 @@ end;
procedure TMainIDE.InitCodeToolBoss;
// initialize the CodeToolBoss, which is the frontend for the codetools.
// - sets a basic set of compiler macros
// - sets a basic set of compiler macros
// ToDo: build a frontend for the codetools and save the settings
procedure AddTemplate(ADefTempl: TDefineTemplate; AddToPool: boolean;
@ -6200,6 +6205,9 @@ end.
{ =============================================================================
$Log$
Revision 1.270 2002/04/03 18:20:49 lazarus
MG: fixed mem leaks
Revision 1.269 2002/04/03 10:34:05 lazarus
MG: fixed crash on open project