Hello, i'm having a strange and somewhat inexplicable issue with ftpTimer.
When i disable it, stop it with the StopTimer procedure, of Free it, there is a change it will freeze and hang the whole application.
I've searched everywhere but wasn't capable to find a solution to it.
This is a small code that reproduce the problem :
var
Form1: TForm1;
MainTimer : TfpTimer;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.CheckOnTimer(Sender: TObject);
begin
Label4.Caption := IntToStr(GetTickCount());
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
MainTimer := TFpTimer.Create(Nil);
MainTimer.OnTimer := @CheckOnTimer;
MainTimer.Interval := 1000;
MainTimer.StartTimer;
end;
procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
MainTimer.StopTimer; // Freeze it on random occasions
MainTimer.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
If MainTimer.Enabled = True Then MainTimer.StopTimer // Turn the timer on or off, freeze it on random occasions
Else MainTimer.StartTimer;
end;
End.
Maybe there is something i'm missing, but i'm really out of ideas.