mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 00:00:39 +02:00
MG: fixed mem leaks
git-svn-id: trunk@1587 -
This commit is contained in:
parent
8867b319ef
commit
20321075df
@ -172,7 +172,7 @@ type
|
|||||||
constructor Create(const AName, ADescription, AVariable, AValue: string;
|
constructor Create(const AName, ADescription, AVariable, AValue: string;
|
||||||
AnAction: TDefineAction);
|
AnAction: TDefineAction);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function ConsistencyCheck: integer; // 0 = ok
|
function ConsistencyCheck: integer; // 0 = ok
|
||||||
procedure WriteDebugReport;
|
procedure WriteDebugReport;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2474,6 +2474,7 @@ begin
|
|||||||
+';..'+ds+'lcl'+ds+'interfaces'+ds+WidgetType
|
+';..'+ds+'lcl'+ds+'interfaces'+ds+WidgetType
|
||||||
+';'+SrcPath
|
+';'+SrcPath
|
||||||
,da_DefineRecurse));
|
,da_DefineRecurse));
|
||||||
|
MainDir.AddChild(DirTempl);
|
||||||
|
|
||||||
if MainDir<>nil then begin
|
if MainDir<>nil then begin
|
||||||
Result:=TDefineTemplate.Create(StdDefTemplLazarusSources,
|
Result:=TDefineTemplate.Create(StdDefTemplLazarusSources,
|
||||||
|
@ -449,8 +449,6 @@ end;
|
|||||||
destructor TheFontsInfoManager.Destroy;
|
destructor TheFontsInfoManager.Destroy;
|
||||||
var APheSharedFontsInfo:PheSharedFontsInfo;
|
var APheSharedFontsInfo:PheSharedFontsInfo;
|
||||||
begin
|
begin
|
||||||
gFontsInfoManager := nil;
|
|
||||||
|
|
||||||
if Assigned(FFontsInfo) then
|
if Assigned(FFontsInfo) then
|
||||||
begin
|
begin
|
||||||
while FFontsInfo.Count > 0 do
|
while FFontsInfo.Count > 0 do
|
||||||
@ -464,6 +462,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
|
gFontsInfoManager := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TheFontsInfoManager.DestroyFontHandles(
|
procedure TheFontsInfoManager.DestroyFontHandles(
|
||||||
@ -534,12 +533,10 @@ begin
|
|||||||
// free all objects
|
// free all objects
|
||||||
BaseFont.Free;
|
BaseFont.Free;
|
||||||
Dispose(pFontsInfo);
|
Dispose(pFontsInfo);
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
pFontsInfo:=nil;
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
|
pFontsInfo:=nil;
|
||||||
if SynTextDrawerFinalization and (FFontsInfo.Count=0) then
|
if SynTextDrawerFinalization and (FFontsInfo.Count=0) then
|
||||||
// the program is in the finalization phase
|
// the program is in the finalization phase
|
||||||
// and this object is not used anymore -> destroy it
|
// and this object is not used anymore -> destroy it
|
||||||
@ -779,7 +776,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
pInfo := GetFontsInfoManager.GetFontsInfo(Value);
|
pInfo := GetFontsInfoManager.GetFontsInfo(Value);
|
||||||
if pInfo = FpInfo then begin
|
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
|
end else begin
|
||||||
ReleaseFontsInfo;
|
ReleaseFontsInfo;
|
||||||
FpInfo := pInfo;
|
FpInfo := pInfo;
|
||||||
@ -1303,6 +1304,9 @@ finalization
|
|||||||
// So, the flag SynTextDrawerFinalization is set and the gFontsInfoManager
|
// So, the flag SynTextDrawerFinalization is set and the gFontsInfoManager
|
||||||
// will destroy itself, as soon, as it is not used anymore.
|
// will destroy itself, as soon, as it is not used anymore.
|
||||||
SynTextDrawerFinalization:=true;
|
SynTextDrawerFinalization:=true;
|
||||||
|
if Assigned(gFontsInfoManager) and (gFontsInfoManager.FFontsInfo.Count=0)
|
||||||
|
then
|
||||||
|
FreeAndNil(gFontsInfoManager);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
FreeAndNil(gFontsInfoManager);
|
FreeAndNil(gFontsInfoManager);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
14
ide/main.pp
14
ide/main.pp
@ -626,6 +626,7 @@ begin
|
|||||||
FreeThenNil(MiscellaneousOptions);
|
FreeThenNil(MiscellaneousOptions);
|
||||||
FreeThenNil(EditorOpts);
|
FreeThenNil(EditorOpts);
|
||||||
FreeThenNil(EnvironmentOptions);
|
FreeThenNil(EnvironmentOptions);
|
||||||
|
FreeThenNil(InputHistories);
|
||||||
FreeThenNil(HintTimer1);
|
FreeThenNil(HintTimer1);
|
||||||
FreeThenNil(HintWindow1);
|
FreeThenNil(HintWindow1);
|
||||||
|
|
||||||
@ -4603,7 +4604,9 @@ var
|
|||||||
ACaption,AText:string;
|
ACaption,AText:string;
|
||||||
begin
|
begin
|
||||||
repeat
|
repeat
|
||||||
writeln('[TMainIDE.DoLoadCodeBuffer] A ',AFilename);
|
{$IFDEF IDE_DEBUG}
|
||||||
|
writeln('[TMainIDE.DoLoadCodeBuffer] A ',AFilename);
|
||||||
|
{$ENDIF}
|
||||||
if (lbfCheckIfText in Flags)
|
if (lbfCheckIfText in Flags)
|
||||||
and FileExists(AFilename) and (not FileIsText(AFilename))
|
and FileExists(AFilename) and (not FileIsText(AFilename))
|
||||||
then begin
|
then begin
|
||||||
@ -4619,7 +4622,9 @@ writeln('[TMainIDE.DoLoadCodeBuffer] A ',AFilename);
|
|||||||
lbfRevert in Flags);
|
lbfRevert in Flags);
|
||||||
if ACodeBuffer<>nil then begin
|
if ACodeBuffer<>nil then begin
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
writeln('[TMainIDE.DoLoadCodeBuffer] ',ACodeBuffer.SourceLength,' ',ACodeBuffer.Filename);
|
{$IFDEF IDE_DEBUG}
|
||||||
|
writeln('[TMainIDE.DoLoadCodeBuffer] ',ACodeBuffer.SourceLength,' ',ACodeBuffer.Filename);
|
||||||
|
{$ENDIF}
|
||||||
end else begin
|
end else begin
|
||||||
ACaption:='Read Error';
|
ACaption:='Read Error';
|
||||||
AText:='Unable to read file "'+AFilename+'"!';
|
AText:='Unable to read file "'+AFilename+'"!';
|
||||||
@ -5198,7 +5203,7 @@ end;
|
|||||||
|
|
||||||
procedure TMainIDE.InitCodeToolBoss;
|
procedure TMainIDE.InitCodeToolBoss;
|
||||||
// initialize the CodeToolBoss, which is the frontend for the codetools.
|
// 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
|
// ToDo: build a frontend for the codetools and save the settings
|
||||||
|
|
||||||
procedure AddTemplate(ADefTempl: TDefineTemplate; AddToPool: boolean;
|
procedure AddTemplate(ADefTempl: TDefineTemplate; AddToPool: boolean;
|
||||||
@ -6200,6 +6205,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$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
|
Revision 1.269 2002/04/03 10:34:05 lazarus
|
||||||
MG: fixed crash on open project
|
MG: fixed crash on open project
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user