Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

methodtMailConnectionThread.Create

constructor Create(aListener: tMailListener; var aSocket: tAbstractSocket; const aPeer: string); virtual;
VIRTUAL for the same reason tMailChannel.Create is - it is reached through tMailConnectionThreadClass.

aSocket IS VAR, AND IT IS SET TO nil THE MOMENT THE CHANNEL TAKES IT. That is the only way the caller can tell whether ownership moved: if anything after the channel exists raises, this thread's destructor runs, releases the channel and the channel frees the socket - so a caller that also freed it on the way out would free it twice. Non-nil on the way back out of an exception means the socket is still the caller's problem.