Board index » delphi » problem with TIdMappedPortTCP

problem with TIdMappedPortTCP

Hello!
I have a small problem with TIdMappedPortTCP.
TIdMappedPortTCP has the code:

procedure TIdMappedPortTCP.DoDisconnect(AThread: TIdPeerThread);
Begin
  inherited DoDisconnect(AThread);
  if TIdMappedPortThread(AThread).FOutboundClient.Connected then
    TIdMappedPortThread(AThread).FOutboundClient.Disconnect;
End;

But in my case this leads to access violation, because FOutboundClient is
not allocated yet. I propose to add the line to fix the problem:

if Assigned(TIdMappedPortThread(AThread).FOutboundClient) then

Thanks,
    Oleg.

 

Re:problem with TIdMappedPortTCP


Another problem:

destructor TIdMappedPortThread.Destroy;
begin
  //^FreeAndNil(FOutboundClient);
  FreeAndNil(FReadList);
  inherited Destroy;
End;

Why not to free FOutboundClient?

Thanks,
    Oleg.

Other Threads