fixed mem leak thx to Vincent

git-svn-id: trunk@4835 -
This commit is contained in:
mattias 2003-11-23 14:09:45 +00:00
parent f747e69c96
commit c5ee613bc8
2 changed files with 81 additions and 78 deletions

View File

@ -3199,7 +3199,7 @@ begin
y:=2; y:=2;
chkSymD2Ext := TCheckBox.Create(grpSymantecChk); chkSymD2Ext := TCheckBox.Create(Self);
with chkSymD2Ext do with chkSymD2Ext do
begin begin
Parent := grpSymantecChk; Parent := grpSymantecChk;
@ -3211,7 +3211,7 @@ begin
end; end;
inc(y,yDiff); inc(y,yDiff);
chkSymCOper := TCheckBox.Create(grpSymantecChk); chkSymCOper := TCheckBox.Create(Self);
with chkSymCOper do with chkSymCOper do
begin begin
Parent := grpSymantecChk; Parent := grpSymantecChk;
@ -3223,7 +3223,7 @@ begin
end; end;
inc(y,yDiff); inc(y,yDiff);
chkSymIncludeAssertions := TCheckBox.Create(grpSymantecChk); chkSymIncludeAssertions := TCheckBox.Create(Self);
with chkSymIncludeAssertions do with chkSymIncludeAssertions do
begin begin
Parent := grpSymantecChk; Parent := grpSymantecChk;
@ -3235,7 +3235,7 @@ begin
end; end;
inc(y,yDiff); inc(y,yDiff);
chkSymAllowLab := TCheckBox.Create(grpSymantecChk); chkSymAllowLab := TCheckBox.Create(Self);
with chkSymAllowLab do with chkSymAllowLab do
begin begin
Parent := grpSymantecChk; Parent := grpSymantecChk;
@ -3247,7 +3247,7 @@ begin
end; end;
inc(y,yDiff); inc(y,yDiff);
chkSymCPPInline := TCheckBox.Create(grpSymantecChk); chkSymCPPInline := TCheckBox.Create(Self);
with chkSymCPPInline do with chkSymCPPInline do
begin begin
Parent := grpSymantecChk; Parent := grpSymantecChk;
@ -3259,7 +3259,7 @@ begin
end; end;
inc(y,yDiff); inc(y,yDiff);
chkSymCMacros := TCheckBox.Create(grpSymantecChk); chkSymCMacros := TCheckBox.Create(Self);
with chkSymCMacros do with chkSymCMacros do
begin begin
Parent := grpSymantecChk; Parent := grpSymantecChk;
@ -3271,7 +3271,7 @@ begin
end; end;
inc(y,yDiff); inc(y,yDiff);
chkSymTP7Compat := TCheckBox.Create(grpSymantecChk); chkSymTP7Compat := TCheckBox.Create(Self);
with chkSymTP7Compat do with chkSymTP7Compat do
begin begin
Parent := grpSymantecChk; Parent := grpSymantecChk;
@ -3283,7 +3283,7 @@ begin
end; end;
inc(y,yDiff); inc(y,yDiff);
chkSymConstInit := TCheckBox.Create(grpSymantecChk); chkSymConstInit := TCheckBox.Create(Self);
with chkSymConstInit do with chkSymConstInit do
begin begin
Parent := grpSymantecChk; Parent := grpSymantecChk;
@ -3295,7 +3295,7 @@ begin
end; end;
inc(y,yDiff); inc(y,yDiff);
chkSymStaticKwd := TCheckBox.Create(grpSymantecChk); chkSymStaticKwd := TCheckBox.Create(Self);
with chkSymStaticKwd do with chkSymStaticKwd do
begin begin
Parent := grpSymantecChk; Parent := grpSymantecChk;
@ -3307,7 +3307,7 @@ begin
end; end;
inc(y,yDiff); inc(y,yDiff);
chkSymDelphiCompat := TCheckBox.Create(grpSymantecChk); chkSymDelphiCompat := TCheckBox.Create(Self);
with chkSymDelphiCompat do with chkSymDelphiCompat do
begin begin
Parent := grpSymantecChk; Parent := grpSymantecChk;
@ -3319,7 +3319,7 @@ begin
end; end;
inc(y,yDiff); inc(y,yDiff);
chkSymUseAnsiStrings := TCheckBox.Create(grpSymantecChk); chkSymUseAnsiStrings := TCheckBox.Create(Self);
with chkSymUseAnsiStrings do with chkSymUseAnsiStrings do
begin begin
Parent := grpSymantecChk; Parent := grpSymantecChk;
@ -3331,7 +3331,7 @@ begin
end; end;
inc(y,yDiff); inc(y,yDiff);
chkSymGPCCompat := TCheckBox.Create(grpSymantecChk); chkSymGPCCompat := TCheckBox.Create(Self);
with chkSymGPCCompat do with chkSymGPCCompat do
begin begin
Parent := grpSymantecChk; Parent := grpSymantecChk;
@ -3381,7 +3381,7 @@ begin
Caption := dlgCOChecks ; Caption := dlgCOChecks ;
end; end;
chkChecksIO := TCheckBox.Create(grpChecks); chkChecksIO := TCheckBox.Create(Self);
with chkChecksIO do with chkChecksIO do
begin begin
Parent := grpChecks; Parent := grpChecks;
@ -3392,7 +3392,7 @@ begin
Width := 70; Width := 70;
end; end;
chkChecksRange := TCheckBox.Create(grpChecks); chkChecksRange := TCheckBox.Create(Self);
with chkChecksRange do with chkChecksRange do
begin begin
Parent := grpChecks; Parent := grpChecks;
@ -3403,7 +3403,7 @@ begin
Width := 90; Width := 90;
end; end;
chkChecksOverflow := TCheckBox.Create(grpChecks); chkChecksOverflow := TCheckBox.Create(Self);
with chkChecksOverflow do with chkChecksOverflow do
begin begin
Parent := grpChecks; Parent := grpChecks;
@ -3414,7 +3414,7 @@ begin
Width := 80; Width := 80;
end; end;
chkChecksStack := TCheckBox.Create(grpChecks); chkChecksStack := TCheckBox.Create(Self);
with chkChecksStack do with chkChecksStack do
begin begin
Parent := grpChecks; Parent := grpChecks;
@ -3546,7 +3546,7 @@ begin
Caption := dlgOptimiz ; Caption := dlgOptimiz ;
end; end;
chkOptVarsInReg := TCheckBox.Create(grpOptimizations); chkOptVarsInReg := TCheckBox.Create(Self);
with chkOptVarsInReg do with chkOptVarsInReg do
begin begin
Parent := grpOptimizations; Parent := grpOptimizations;
@ -3557,7 +3557,7 @@ begin
Width := 330; Width := 330;
end; end;
chkOptUncertain := TCheckBox.Create(grpOptimizations); chkOptUncertain := TCheckBox.Create(Self);
with chkOptUncertain do with chkOptUncertain do
begin begin
Parent := grpOptimizations; Parent := grpOptimizations;
@ -3649,7 +3649,7 @@ begin
Caption := dlgCODebugging ; Caption := dlgCODebugging ;
end; end;
chkDebugGDB := TCheckBox.Create(grpDebugging); chkDebugGDB := TCheckBox.Create(Self);
with chkDebugGDB do with chkDebugGDB do
begin begin
Parent := grpDebugging; Parent := grpDebugging;
@ -3660,7 +3660,7 @@ begin
Width := 360; Width := 360;
end; end;
chkDebugDBX := TCheckBox.Create(grpDebugging); chkDebugDBX := TCheckBox.Create(Self);
with chkDebugDBX do with chkDebugDBX do
begin begin
Parent := grpDebugging; Parent := grpDebugging;
@ -3671,7 +3671,7 @@ begin
Width := 360; Width := 360;
end; end;
chkUseLineInfoUnit := TCheckBox.Create(grpDebugging); chkUseLineInfoUnit := TCheckBox.Create(Self);
with chkUseLineInfoUnit do with chkUseLineInfoUnit do
begin begin
Parent := grpDebugging; Parent := grpDebugging;
@ -3682,7 +3682,7 @@ begin
Width := 360; Width := 360;
end; end;
chkUseHeaptrc := TCheckBox.Create(grpDebugging); chkUseHeaptrc := TCheckBox.Create(Self);
with chkUseHeaptrc do with chkUseHeaptrc do
begin begin
Parent := grpDebugging; Parent := grpDebugging;
@ -3693,7 +3693,7 @@ begin
Width := 360; Width := 360;
end; end;
chkGenGProfCode := TCheckBox.Create(grpDebugging); chkGenGProfCode := TCheckBox.Create(Self);
with chkGenGProfCode do with chkGenGProfCode do
begin begin
Parent := grpDebugging; Parent := grpDebugging;
@ -3704,7 +3704,7 @@ begin
Width := 360; Width := 360;
end; end;
chkSymbolsStrip := TCheckBox.Create(grpDebugging); chkSymbolsStrip := TCheckBox.Create(Self);
with chkSymbolsStrip do with chkSymbolsStrip do
begin begin
Parent := grpDebugging; Parent := grpDebugging;
@ -3728,7 +3728,7 @@ begin
Caption := dlgLinkLibraries ; Caption := dlgLinkLibraries ;
end; end;
radLibsLinkDynamic := TRadioButton.Create(grpLinkLibraries); radLibsLinkDynamic := TRadioButton.Create(Self);
with radLibsLinkDynamic do with radLibsLinkDynamic do
begin begin
Parent := grpLinkLibraries; Parent := grpLinkLibraries;
@ -3739,7 +3739,7 @@ begin
Width := Parent.Width-10; Width := Parent.Width-10;
end; end;
radLibsLinkStatic := TRadioButton.Create(grpLinkLibraries); radLibsLinkStatic := TRadioButton.Create(Self);
with radLibsLinkStatic do with radLibsLinkStatic do
begin begin
Parent := grpLinkLibraries; Parent := grpLinkLibraries;
@ -3750,7 +3750,7 @@ begin
Width := Parent.Width-10; Width := Parent.Width-10;
end; end;
radLibsLinkSmart := TRadioButton.Create(grpLinkLibraries); radLibsLinkSmart := TRadioButton.Create(Self);
with radLibsLinkSmart do with radLibsLinkSmart do
begin begin
Parent := grpLinkLibraries; Parent := grpLinkLibraries;
@ -3773,13 +3773,13 @@ begin
Caption := lisCOTargetOSSpecificOptions; Caption := lisCOTargetOSSpecificOptions;
end; end;
chkWin32GraphicApp := TCheckBox.Create(grpOptions); chkWin32GraphicApp := TCheckBox.Create(Self);
with chkWin32GraphicApp do with chkWin32GraphicApp do
begin begin
Parent := TargetSpecificsGrpBox; Parent := TargetSpecificsGrpBox;
Caption := 'Win32 gui application (-WG)'; Caption := 'Win32 gui application (-WG)';
Top := 5; Top := 5;
Left := 0; Left := 2;
Height := 22; Height := 22;
Width := Parent.Width-10; Width := Parent.Width-10;
end; end;
@ -3797,7 +3797,7 @@ begin
Caption := dlgCOOpts; Caption := dlgCOOpts;
end; end;
chkOptionsLinkOpt := TCheckBox.Create(grpOptions); chkOptionsLinkOpt := TCheckBox.Create(Self);
with chkOptionsLinkOpt do with chkOptionsLinkOpt do
begin begin
Parent := grpOptions; Parent := grpOptions;
@ -3839,7 +3839,7 @@ begin
Caption := dlgVerbosity; Caption := dlgVerbosity;
end; end;
chkErrors := TCheckBox.Create(grpVerbosity); chkErrors := TCheckBox.Create(Self);
with chkErrors do with chkErrors do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3850,7 +3850,7 @@ begin
Width := (grpVerbosity.ClientWidth div 2)-12; Width := (grpVerbosity.ClientWidth div 2)-12;
end; end;
chkWarnings := TCheckBox.Create(grpVerbosity); chkWarnings := TCheckBox.Create(Self);
with chkWarnings do with chkWarnings do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3861,7 +3861,7 @@ begin
Width := chkErrors.Width; Width := chkErrors.Width;
end; end;
chkNotes := TCheckBox.Create(grpVerbosity); chkNotes := TCheckBox.Create(Self);
with chkNotes do with chkNotes do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3872,7 +3872,7 @@ begin
Width := chkErrors.Width; Width := chkErrors.Width;
end; end;
chkHints := TCheckBox.Create(grpVerbosity); chkHints := TCheckBox.Create(Self);
with chkHints do with chkHints do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3883,7 +3883,7 @@ begin
Width := chkErrors.Width; Width := chkErrors.Width;
end; end;
chkGeneralInfo := TCheckBox.Create(grpVerbosity); chkGeneralInfo := TCheckBox.Create(Self);
with chkGeneralInfo do with chkGeneralInfo do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3894,7 +3894,7 @@ begin
Width := chkErrors.Width; Width := chkErrors.Width;
end; end;
chkLineNumbers := TCheckBox.Create(grpVerbosity); chkLineNumbers := TCheckBox.Create(Self);
with chkLineNumbers do with chkLineNumbers do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3905,7 +3905,7 @@ begin
Width := chkErrors.Width; Width := chkErrors.Width;
end; end;
chkAllProcsOnError := TCheckBox.Create(grpVerbosity); chkAllProcsOnError := TCheckBox.Create(Self);
with chkAllProcsOnError do with chkAllProcsOnError do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3916,7 +3916,7 @@ begin
Width := chkErrors.Width; Width := chkErrors.Width;
end; end;
chkEverything := TCheckBox.Create(grpVerbosity); chkEverything := TCheckBox.Create(Self);
with chkEverything do with chkEverything do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3927,7 +3927,7 @@ begin
Width := chkErrors.Width; Width := chkErrors.Width;
end; end;
chkDebugInfo := TCheckBox.Create(grpVerbosity); chkDebugInfo := TCheckBox.Create(Self);
with chkDebugInfo do with chkDebugInfo do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3938,7 +3938,7 @@ begin
Width := (grpVerbosity.ClientWidth div 2)-12; Width := (grpVerbosity.ClientWidth div 2)-12;
end; end;
chkUsedFiles := TCheckBox.Create(grpVerbosity); chkUsedFiles := TCheckBox.Create(Self);
with chkUsedFiles do with chkUsedFiles do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3949,7 +3949,7 @@ begin
Width := chkDebugInfo.Width; Width := chkDebugInfo.Width;
end; end;
chkTriedFiles := TCheckBox.Create(grpVerbosity); chkTriedFiles := TCheckBox.Create(Self);
with chkTriedFiles do with chkTriedFiles do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3960,7 +3960,7 @@ begin
Width := chkDebugInfo.Width; Width := chkDebugInfo.Width;
end; end;
chkDefinedMacros := TCheckBox.Create(grpVerbosity); chkDefinedMacros := TCheckBox.Create(Self);
with chkDefinedMacros do with chkDefinedMacros do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3971,7 +3971,7 @@ begin
Width := chkDebugInfo.Width; Width := chkDebugInfo.Width;
end; end;
chkCompiledProc := TCheckBox.Create(grpVerbosity); chkCompiledProc := TCheckBox.Create(Self);
with chkCompiledProc do with chkCompiledProc do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3982,7 +3982,7 @@ begin
Width := chkDebugInfo.Width; Width := chkDebugInfo.Width;
end; end;
chkConditionals := TCheckBox.Create(grpVerbosity); chkConditionals := TCheckBox.Create(Self);
with chkConditionals do with chkConditionals do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -3993,7 +3993,7 @@ begin
Width := chkDebugInfo.Width; Width := chkDebugInfo.Width;
end; end;
chkNothing := TCheckBox.Create(grpVerbosity); chkNothing := TCheckBox.Create(Self);
with chkNothing do with chkNothing do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -4015,7 +4015,7 @@ begin
Width := chkDebugInfo.Width; Width := chkDebugInfo.Width;
end; end;
chkHintsForUnusedProjectUnits := TCheckBox.Create(grpVerbosity); chkHintsForUnusedProjectUnits := TCheckBox.Create(Self);
with chkHintsForUnusedProjectUnits do with chkHintsForUnusedProjectUnits do
begin begin
Parent := grpVerbosity; Parent := grpVerbosity;
@ -4066,7 +4066,7 @@ begin
Caption := dlgConfigFiles ; Caption := dlgConfigFiles ;
end; end;
chkConfigFile := TCheckBox.Create(grpConfigFile); chkConfigFile := TCheckBox.Create(Self);
with chkConfigFile do with chkConfigFile do
begin begin
Parent := grpConfigFile; Parent := grpConfigFile;
@ -4077,7 +4077,7 @@ begin
Width := 330; Width := 330;
end; end;
chkAdditionalConfigFile := TCheckBox.Create(grpConfigFile); chkAdditionalConfigFile := TCheckBox.Create(Self);
with chkAdditionalConfigFile do with chkAdditionalConfigFile do
begin begin
Parent := grpConfigFile; Parent := grpConfigFile;
@ -4318,7 +4318,7 @@ begin
inc(y,Height+5); inc(y,Height+5);
end; end;
edtOtherUnits := TEdit.Create(grpOtherUnits); edtOtherUnits := TEdit.Create(Self);
with edtOtherUnits do with edtOtherUnits do
begin begin
Parent := grpOtherUnits; Parent := grpOtherUnits;
@ -4356,7 +4356,7 @@ begin
inc(y,Height+5); inc(y,Height+5);
end; end;
edtIncludeFiles := TEdit.Create(grpIncludeFiles); edtIncludeFiles := TEdit.Create(Self);
with edtIncludeFiles do with edtIncludeFiles do
begin begin
Parent := grpIncludeFiles; Parent := grpIncludeFiles;
@ -4393,7 +4393,7 @@ begin
inc(y,Height+5); inc(y,Height+5);
end; end;
edtOtherSources := TEdit.Create(grpIncludeFiles); edtOtherSources := TEdit.Create(Self);
with edtOtherSources do with edtOtherSources do
begin begin
Parent := grpOtherSources; Parent := grpOtherSources;
@ -4430,7 +4430,7 @@ begin
inc(y,Height+5); inc(y,Height+5);
end; end;
edtLibraries := TEdit.Create(grpLibraries); edtLibraries := TEdit.Create(Self);
with edtLibraries do with edtLibraries do
begin begin
Parent := grpLibraries; Parent := grpLibraries;

View File

@ -530,13 +530,7 @@ begin
end; end;
procedure TBitmap.WriteStream(Stream: TStream; WriteSize: Boolean); procedure TBitmap.WriteStream(Stream: TStream; WriteSize: Boolean);
{$IFDEF UseFPImage} {$IFNDEF UseFPImage}
begin
WriteStreamWithFPImage(Stream,WriteSize,TFPWriterBMP);
if (FImage.SaveStream<>nil) and (FImage.SaveStreamType=bnNone) then
FImage.SaveStreamType:=bnWinBitmap;
end;
{$ELSE}
Type Type
TBITMAPHEADER = packed record TBITMAPHEADER = packed record
FileHeader : tagBitmapFileHeader; FileHeader : tagBitmapFileHeader;
@ -547,6 +541,24 @@ var
MemStream: TMemoryStream; MemStream: TMemoryStream;
Procedure DoWriteStreamSize(DestStream: TStream; Size: longint);
begin
if WriteSize then
DestStream.WriteBuffer(Size, SizeOf(Size));
end;
procedure DoWriteOriginal;
begin
DoWriteStreamSize(Stream,FImage.SaveStream.Size);
FImage.SaveStream.Position:=0;
Stream.CopyFrom(FImage.SaveStream,FImage.SaveStream.Size);
end;
Procedure DoWriteSize(Header: TBitmapHeader);
begin
DoWriteStreamSize(MemStream,Header.FileHeader.bfSize);
end;
Procedure FillBitmapInfo(Bitmap : hBitmap; var Bits : Pointer; Procedure FillBitmapInfo(Bitmap : hBitmap; var Bits : Pointer;
Var Header : TBitmapHeader); Var Header : TBitmapHeader);
var var
@ -585,17 +597,6 @@ var
end; end;
end; end;
Procedure DoWriteStreamSize(DestStream: TStream; Size: longint);
begin
if WriteSize then
DestStream.WriteBuffer(Size, SizeOf(Size));
end;
Procedure DoWriteSize(Header: TBitmapHeader);
begin
DoWriteStreamSize(MemStream,Header.FileHeader.bfSize);
end;
Procedure WriteBitmapHeader(Header : TBitmapHeader); Procedure WriteBitmapHeader(Header : TBitmapHeader);
begin begin
MemStream.WriteBuffer(Header, SizeOf(Header)); MemStream.WriteBuffer(Header, SizeOf(Header));
@ -642,17 +643,16 @@ var
MemStream.WriteBuffer(Bits^, Header.InfoHeader.biSizeImage); MemStream.WriteBuffer(Bits^, Header.InfoHeader.biSizeImage);
end; end;
procedure DoWriteOriginal;
begin
DoWriteStreamSize(Stream,FImage.SaveStream.Size);
FImage.SaveStream.Position:=0;
Stream.CopyFrom(FImage.SaveStream,FImage.SaveStream.Size);
end;
var var
Bits: PByte; Bits: PByte;
Header: TBitmapHeader; Header: TBitmapHeader;
{$ENDIF}
begin begin
{$IFDEF UseFPImage}
WriteStreamWithFPImage(Stream,WriteSize,TFPWriterBMP);
if (FImage.SaveStream<>nil) and (FImage.SaveStreamType=bnNone) then
FImage.SaveStreamType:=bnWinBitmap;
{$ELSE}
if (FImage.SaveStream<>nil) and (FImage.SaveStream.Size>0) if (FImage.SaveStream<>nil) and (FImage.SaveStream.Size>0)
and (FImage.SaveStreamType<>bnNone) then begin and (FImage.SaveStreamType<>bnNone) then begin
DoWriteOriginal; DoWriteOriginal;
@ -681,8 +681,8 @@ begin
ReallocMem(Bits, 0); ReallocMem(Bits, 0);
MemStream.Free; MemStream.Free;
end; end;
end;
{$ENDIF} {$ENDIF}
end;
procedure TBitmap.StoreOriginalStream(Stream: TStream); procedure TBitmap.StoreOriginalStream(Stream: TStream);
var var
@ -953,6 +953,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.50 2003/11/23 14:09:45 mattias
fixed mem leak thx to Vincent
Revision 1.49 2003/10/22 18:43:23 mattias Revision 1.49 2003/10/22 18:43:23 mattias
prepared image sharing prepared image sharing