procedure TStreamedConnection.InternalClose;
begin
if Assigned(FTransport) then
begin
FTransport.OnTerminate := nil;
FTransport.Terminate;
PostThreadMessage(FTransport.ThreadID, WM_USER, 0, 0);
然后在它的后面加上一句:
if GetCurrentThreadID = MainThreadID then
Classes.CheckSynchronize;