11-22-2019, 02:42 AM
Checking for nil is not good enough, all it does is introduce a new race condition and doesn't address the root issue of the TIdSSLSocket object being freed while it is still actively being used. This same issue also affects TIdTCPServer, see this ticket. In that ticket, just closing the underlying socket without destroying the SSL object worked. A similar solution would likely apply here, too.