Subject | Problem with IB_Session |
---|---|
Author | Robert martin |
Post date | 2006-08-30T00:14:57Z |
Hi
I have been using IB_Sesion through a multi-threaded application without
problem for some time. However this morning I have been having major
problems with a new thread I created.
When the thread frees it causes multiple AVs (close one, get another).
I have tracked through the code and reduced it down so it essentially
creates and frees. The only component being created or freed now is an
IB_Session. I have discovered the difference between this thread and
others, this one uses FreeOnTerminate, my other threads are manually
freed. If I change the thread to be manually freed it no longer AVs.
Any suggestions as to what I am doing wrong?
Sample code follows (All code in the execute has been removed) All
other code in the creator and destructor has been commented out)
Thread
constructor TSendFTP.Create(ibPath, ibServer : String);
begin
inherited Create(True);
FreeOnTerminate := True;
fIb_Session := TIB_Session.Create(Nil);
fIb_Session.UseCursor := False;
end;
destructor TSendFTP.Destroy;
begin
if (fIb_Session <> Nil) then begin
fIb_Session.Free;
end;
inherited Destroy;
end;
//Calling code
FTP := TSendFTP.Create(Path, Server);
FTP.UploadFile(FileName, False); //UploadFile triggers the
execute method
--
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd
I have been using IB_Sesion through a multi-threaded application without
problem for some time. However this morning I have been having major
problems with a new thread I created.
When the thread frees it causes multiple AVs (close one, get another).
I have tracked through the code and reduced it down so it essentially
creates and frees. The only component being created or freed now is an
IB_Session. I have discovered the difference between this thread and
others, this one uses FreeOnTerminate, my other threads are manually
freed. If I change the thread to be manually freed it no longer AVs.
Any suggestions as to what I am doing wrong?
Sample code follows (All code in the execute has been removed) All
other code in the creator and destructor has been commented out)
Thread
constructor TSendFTP.Create(ibPath, ibServer : String);
begin
inherited Create(True);
FreeOnTerminate := True;
fIb_Session := TIB_Session.Create(Nil);
fIb_Session.UseCursor := False;
end;
destructor TSendFTP.Destroy;
begin
if (fIb_Session <> Nil) then begin
fIb_Session.Free;
end;
inherited Destroy;
end;
//Calling code
FTP := TSendFTP.Create(Path, Server);
FTP.UploadFile(FileName, False); //UploadFile triggers the
execute method
--
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd