 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Joel Harris Guest
|
Posted: Sun Sep 21, 2003 5:39 am Post subject: Bug Fix for Indy 9.0.14 - TIdPeerThread.Data destruction ord |
|
|
Using Indy 9.0.14
If you are using the data property of the TIdPeerThread, you'll want to
modify your Indy source code a bit (IdTCPServer.pas) to avoid a possible
access violation. The code below displays the required modification. In
the original code, "inherited Cleanup" is called at the beginning of this
procedure. The inherited procedure simply frees the object associated with
the Data property. If that occurs before the thread is removed from the
TCPServer.ThreadList and another thread is trying to access the data
property of the thread being deleted, an access violation will occur. I
have moved the inherited call after the thread is removed from the
ThreadList and before the Thread is released. I think I've covered all
angles here, but if anyone sees something I've overlooked, let me know.
procedure TIdPeerThread.Cleanup;
begin
if Assigned(FConnection) then begin
if Assigned(FConnection.Server) then begin
{ Remove is not neede if we are going to use only ActiveThreads;
Threads.Remove(Self);}
with Connection.Server do begin
if Assigned(Threads) then begin
Threads.Remove(SELF);
end;
end;//with
end;//if
end;
inherited Cleanup; //this is where the object associated with the data
property is deleted
if Assigned(FConnection) then begin
if Assigned(FConnection.Server) then begin
with Connection.Server do begin
//from AfterRun
if Assigned(ThreadMgr) then begin
ThreadMgr.ReleaseThread(Self);
end;
end;//with
end;//if
FreeAndNil(FConnection);
end;
// Other things are done in AfterExecute&destructor
End;//TIdPeerThread.Cleanup
--
Joel Harris
Ebbhead89
remove XYZ from contact address
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|