If I had to guess (and the tooltip you shouldn't confirms that) I'd say that you did not correctly create the instance of TLogAGI. Maybe you did YourVar.Create instead of YourVar := TLogAGI.Create?
But I cannot wrap my head around the fact that I could step through the code until I get to the assignment line for the boolean, when it crashed....
If it was not created surely it would crash directly on any access including the code???
Anyway, concerning the creation etc...
The original application used a (nonvisual) logging component, which in Delphi was placed on the main form.
In the ported version I have removed the non-visual component dropped on the form and instead create it in Form.Create():
procedure TfrmSSRemoteClient.FormCreate(Sender: TObject);
begin
btnCopyServerFile.Caption := '';
btnCopyClientFile.Caption := '';
FixWindows;
Log3R1 := TLogAGI.Create; //<== Created here when the form is created
Log3R1.LogPrefix := 'RSC';
Log3R1.LogExtension := 'log';
end;
However there is also a Form.Loaded procedure implemented in this application and it starts out like this where it sets some properties of the log component and then calls StartLog().
It is when running StartLog the exception happens.
procedure TfrmSSRemoteClient.Loaded;
var
slSect: TStringList;
i: integer;
LI: TlistItem;
begin
inherited;
FOriginalCaption := Caption;
{Set up logging and initialize the program}
Log3R1.LogDirectory := ReadIniString('Logging','LogDir', ExtractFilePath(ParamStr(0)) + 'log');
Log3R1.LogPrefix := 'RC';
Log3R1.Debug := ReadIniBool('Logging','Debug',true);
Log3R1.StartLog();
FSSRemoteClient := TSSRemoteClient.Create(Self);
FSSRemoteClient.Log := Log3R1;
....
So the order of execution of form.FormCreate and form.Loaded matters here....
When I moved the logging component from being dropped to being created I put its creation into FormCreate.
Question:Which happens first, Create or Loaded?
So to find out I put a break point at the top of both and it reaches the Loaded break first!
Which means that as you suspected the object was not yet created when it was used.
I moved create into Loaded() and now everything works!
Thanks for putting me on the right track for this error hunt!