TidTCPServer.Active := false (closing connections)

I tried calling Server.Active := false and it has its own code for
terminating all threads, but i get an access violation in
TerminateAllThreads which it is calling.

I tried my own code also and i get an AV.

  if tcpServer.Active then
  begin
    zList := tcpServer.ThreadMgr.ActiveThreads.LockList;
    try
      for idx := 0 to zList.Count - 1 do
      begin
        TidPeerThread(zList[idx]).Connection.DisconnectSocket;
        TidPeerThread(zList[idx]).TerminateAndWaitFor;
      end;
    finally
      tcpServer.ThreadMgr.ActiveThreads.UnlockList;
    end;
  end;

--
Lee Connell
Live Technology International
2975 Westchester Avenue
Suite 103
Purchase, NY 10577
Tel: 914-684-5941
Cell: 914-661-0196
lconn...@livetechnology.com
www.LiveTechnology.com