I suggest you to use sender() method to find a singnal emitting object if signal connected to this slot is emited by socket object, and add additional QMap<QTcpSocket*, QTreeWidgetItem*>
It will be easy to find what exactly you should remove i think...
Bookmarks