to (the author of the component and) anyone who uses the msn component from this forum:
You should consider the way you are currently terminating your reader thread in your tidtcpclient desc. The way this terminate is coded is not vcl thread safe. If an exception occurs in the thread in combination with fire an event the you can have av's when calling vcl objects (like the mainform of your project where the component is dropped on, and you coded an event handler ondisconnect).
Consider this for thread termination:
[1] FreeOnTerminate:=False;
[2] When terminating the thread:
{* REMOVED: after av on close connection event fire
if Assigned(FTCPClientReader) then
FTCPClientReader.Terminate;}
if Assigned(FTCPClientReader) then
begin
if not FTCPClientReader.terminated then
begin
if FTCPClientReader.suspended then FTCPClientReader.resume;
FTCPClientReader.terminate;
FTCPClientReader.waitfor;
FTCPClientReader.free;
FTCPClientReader := nil;
end;
end;
Of course there are other solutions for this problem like, using messages (postmessage ...) or a more complex desc of the tidtcpclient.
hopefully the solution makes sense otherwise do it your way, but i think you can get "unexpected av's" when doing so
ANYWAYS: I THINK YOU HAVE DONE A GREAT JOB ! IT'S A GOOD EXAMPLE OF DELPHI OOP. Well done guy(s)
Bookmarks