Witam
Mam mały problem z wątkami, nie wiem co jest nie tak. Przykładowy kod:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
TTest = class(TThread)
private
procedure Execute;
end;
var
Form1: TForm1;
t : TTest;
implementation
{$R *.dfm}
procedure TTest.Execute;
begin
Form1.Memo1.Lines.Add('Test');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
T := TTest.Create(true);
t.FreeOnTerminate := true;
t.Resume;
end;
end.
Kompiluje, uruchamiam, tworze wątek i...:
1 - wątek zostaje utworzony i poprawnie wznowiony
2 - po T.Resume i przed procedure Execute, debugger wywala mi błąd "Abstract Error", przy czym wątek przestaje działać.
Czy ktoś mi może wskazać jaki robię błąd?