AV in TIdThreadComponent

Giganews Newsgroups
Subject: AV in TIdThreadComponent
Posted by:  Anders Gustavsson (anders.…@almaSPAMsoft.se)
Date: Mon, 18 Apr 2005

I get an AV when loading a TIdThreadComponent after changing from Indy9
to Indy10:

In the Loaded method it says:

  if Assigned(OnTerminate) then
  begin
    FThread.OnTerminate := DoTerminate;
  end;

and that is where I get the AV: FThread is nil! So I changed it to:

  if Assigned(FThread) and Assigned(OnTerminate) then
  begin
    FThread.OnTerminate := DoTerminate;
  end;

and also added

    if Assigned(OnTerminate) then
      FThread.OnTerminate := DoTerminate;

to the Start method (after FThread is created).

It works ok, but makes me suspicious: Am I the only one using this
component in Indy10 (hasn't seen any other mentioning of this problem)
or am I doing something the wrong way?

/Anders

Replies