Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Apr : Re: TIdFTP.List throwing access violations

www.cryer.info
Managed Newsgroup Archive

Re: TIdFTP.List throwing access violations

Subject:Re: TIdFTP.List throwing access violations
Posted by:"Richard Stephens" (ri..@almsysinc.com)
Date:Sat, 14 Apr 2007 20:57:59

TIdFTP's OnWork was recently changed to make the AWorkCount parameter an
Int64, rather than Integer. The new delcaration is as follows:

procedure TForm1.IdFTP1Work(ASender: TObject; AWorkMode: TWorkMode;
  AWorkCount: Int64);

I do not know what else in the routine changed, but when I even reference
this in TIdFTP's OnWork, the access violation occurs.

When I remove the reference, the program does not storage violate.

Here is a basic example:
-------------------------------------------

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
  IdTCPClient, IdExplicitTLSClientServerBase, IdFTP, IdFTPList,
IdAllFTPListParsers;

type
  TForm1 = class(TForm)
    IdFTP1: TIdFTP;
    Button1: TButton;
    ListBox1: TListBox;
    procedure Button1Click(Sender: TObject);
    procedure IdFTP1Work(ASender: TObject; AWorkMode: TWorkMode;
      AWorkCount: Int64);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  W_LS: TStringList;
begin
  W_LS := TStringList.Create;
  With IdFTP1 do try
    Username := 'xxx'; {Masked out}
    Password := 'xxx'; {Masked out}
    Host := 'xxx'; {Masked out}
    Connect;
  Except
    end;
  IdFTP1.ChangeDir('/');
  IdFTP1.List(W_LS);
  ListBox1.Items.Assign(W_LS);
end;

procedure TForm1.IdFTP1Work(ASender: TObject; AWorkMode: TWorkMode;
  AWorkCount: Int64);
begin
{}
end;

end.
-------------------------------------------

This will access violate every time when the OnWork is set.


Richard

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive