On Mon, 10 Mar 2014 16:46:18 +0100 Antonio Fortuny <[email protected]> wrote:
> 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; inherited; > end; Mattias -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
