Hi Folks.
I've built my first Lazarus package. When it is dynamically created in a test program, it works as it is supposed to work.
When I drop it onto a form and test it with code, looks OK. So far, so good.
But when it try to remove the component from the form where it is has been dropped, the IDE crashes with an Access violation exception I wonder if I didn't forget something in the either construcor or the destructor or both.
At runtime the program crashes with a segmentation fault
constructor TCustomControlTimer.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FTH := TTimerThread.Create;
FTH.FreeOnTerminate := False;
end;
destructor TCustomControlTimer.Destroy;
var
Elapsed: Cardinal;
begin
if Assigned(FTH) then begin
if FTH.Active then begin
FTH.Terminate;
// d?bloquer la boucle d'attente
FTH.EnableEvent.SetEvent;
end;
Elapsed := 0;
while FTH.Active do begin
Sleep(50);
if Elapsed > 5000 then
Break;
Inc(Elapsed, 50)
end;
FreeAndNil(FTH);
end;
end;Antonio.
---
Ce courrier ?lectronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com
