Re: TidSMTPServer Listen Exception

Giganews Newsgroups
Subject: Re: TidSMTPServer Listen Exception
Posted by:  Charles Molnar (charles.moln…@micotan.com)
Date: Thu, 31 Mar 2005

Just in case if anybody has the same problem:

If you create a VCL component in the MsgReceive event do it like this:
1.
MyMessage := TIdMessage.Create( nil );
try
  ...
finally
  FreeAndNil( MyMessage );
end;

2.
FCriticalSection_InComing.Acquire;
try
  MyMessage := TIdMessage.Create( Self );
  try
    ...
  finally
    FreeAndNil( MyMessage );
  end;
finally
  FCriticalSection_InComing.Release;
end;

The problem was that I created the VCL with the owner Self. So it went
and registered itself and that function doesn't seem to be thread safe.

Replies

None

In response to

TidSMTPServer Listen Exception posted by Charles Molnar on Wed, 30 Mar 2005