Highly unlikely.  

I have created a simple form in the following code and it all works

unit UIMain;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
    FFirstStringList: TStringList;
    FSecondStringList: TStringList;
    FThirdStringList: TStringList;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  FFirstStringList := TStringList.Create;
  FSecondStringList := TStringList.Create;
  FThirdStringList := TStringList.Create;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if Assigned (FFirstStringList) then
    FreeAndNil (FFirstStringList);
  if Assigned (FSecondStringList) then
    FreeAndNil (FSecondStringList);
  if Assigned (FThirdStringList) then
    FreeAndNil (FThirdStringList);
end;

end.


Peter Speden
 

-----Original Message-----
From: Alistair George [mailto:[EMAIL PROTECTED] 
Sent: Monday, 3 March 2003 9:46 a.m.
To: Multiple recipients of list delphi
Subject: Re[2]: [DUG]: Freeing Stringlists.

Hello Peter et al,
the below sounds absolutely spiffing. if the stringlist is not used it
will not
free properly in the instances i showed. definitely they are not freed
elswhere;
it is a function of not using them (or another bug in delphi 5).
Al+



Monday, March 3, 2003, 8:18:49 AM, you wrote:
PS> Try

PS> If Assigned (includelist) then
PS>         FreeAndNil (includelist);

PS> Etc

PS> Or 

PS> If includelist <> nil then
PS>         FreeAndNil (includelist);

PS> They are not freed elsewhere are they.

PS> Peter Speden
 
PS> -----Original Message-----
PS> From: Alistair George [mailto:[EMAIL PROTECTED] 
PS> Sent: Saturday, 1 March 2003 1:17 p.m.
PS> To: Multiple recipients of list delphi
PS> Subject: [DUG]: Freeing Stringlists.

PS> Hi all.
PS> I have a lot of trouble freeing string list. they are created in
PS> formcreate:
PS> procedure TMainform.FormCreate(Sender: TObject);
PS> var fversion: string;
PS> begin
PS>   Appath :=
PS> IncludeTrailingBackSlash(ExtractFilePath(Application.EXEName));
PS>   mainform.HelpFile := appath + 'back4winxp.hlp';
PS>   VCLzip1.DoProcessMessages := true;
PS>   VCLzip1.FileOpenMode := fmOpenRead or fmShareDenyNone;
PS>   TheReasonSummary := Tstringlist.Create;
PS>   IncludeList := Tstringlist.Create;
PS>   ZIPfiles := Tstringlist.Create;

PS> But in either case below, they cause a memory error when I close the
PS> form
PS> if they have not been used (below are in FormClose):


PS>   try IncludeList.Free; except end;
PS>   try ZIPfiles.Free; except end;
PS>   try  TheReasonSummary.Free; except end;

PS>   try
PS>     if sizeof(includelist) > 0 then IncludeList.Free;
PS>     if sizeof(ZIPfiles) > 0 then ZIPfiles.Free;
PS>     if sizeof(TheReasonSummary) > 0 then TheReasonSummary.Free;
PS>   except end;


PS> The only working way I find is as follows:
PS> IncludeList:=nil;
PS> ZIPfiles:=nil;
PS> TheReasonSummary:=nil;


PS> Comments????

PS>
------------------------------------------------------------------------
PS> ---
PS>     New Zealand Delphi Users group - Delphi List -
[EMAIL PROTECTED]
PS>                   Website: http://www.delphi.org.nz
PS> To UnSub, send email to: [EMAIL PROTECTED] 
PS> with body of "unsubscribe delphi"
PS> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
PS>
------------------------------------------------------------------------
---
PS>     New Zealand Delphi Users group - Delphi List -
[EMAIL PROTECTED]
PS>                   Website: http://www.delphi.org.nz
PS> To UnSub, send email to: [EMAIL PROTECTED]
PS> with body of "unsubscribe delphi"
PS> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


-- 
Regards,
 Alistair+

------------------------------------------------------------------------
---
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to