I'm using Application.OnIdle to run some init procedures. It worked for years (and still doesn't make any problem with Gtk2 and win64) but init is called now at win32 executable while running CreateForm (fmStatistics.<>:=... but it is nil). This results in runtime error 210 because I try to access data that has not been created. The code looks like this:
procedure TfmMain.FormShow(Sender: TObject);
begin
// create something
Initialized:=false;
Application.OnIdle:=@FormIdle;
end;
procedure TfmMain.FormIdle(Sender: Tobject; var Done: boolean);
begin
if not Initialized then Initialize;
//some other stuff, e.g. OpenGL invalidate
end;
procedure TfmMain.Initialize;
begin
Initialized:=true;
//setup something
//here fmStatistics is accessed but not created
end;
program Scrabble3D;
{$mode objfpc}
...
begin
Application.Initialize;
Application.CreateForm(TfmMain, fmMain);
Application.CreateForm(TfmWordSearch, fmWordSearch);
Application.CreateForm(TfmNewGame, fmNewGame);
Application.CreateForm(TfmAbout, fmAbout);
Application.CreateForm(TfmNetwork, fmNetwork);
Application.CreateForm(TfmRemote, fmRemote);
Application.CreateForm(TfmGameOptions, fmGameOptions);
Application.CreateForm(TfmWelcome, fmWelcome);
Application.CreateForm(TfmStatistics, fmStatistics);
Application.Run;
end.
I added a "if assigned(fmStatistics) then" before Initialize, but I guess it should be fixed somewhere else.
FPC 2.6.0 at all platforms, Lazarus 1.1 r38971M FPC 2.6.0 x86_64-linux-qt (and something similar from SVN on win32@XP).