[fpc-pascal] TThread.WaitFor not returning?

Graeme Geldenhuys graemeg.lists at gmail.com
Wed Sep 17 14:36:59 CEST 2008


On 9/17/08, Michael Van Canneyt <michael at freepascal.org> wrote:
>
> CheckSynchronize must be called by the main thread on a regular basis in
>  the event loop, so this is normal.


CheckSynchronize is called in the main eventloop.  This happens on
application termination.  The gLog singleton is freed in the
finalization section of a unit.  So maybe it's a timing issue?  The
main eventloop has already stopped functioning, by the time the gLog
singleton is being free'd....

[...quickly testing...]

Umm, a quick test seems to reveal that might be the problem. As soon
as the main form closes, the main eventloop stops as well - only then
does the finalization section try to free the gLog singleton which
contains the thread.

Freeing the gLog singleton in the main form's OnClose event, seems to
resolve the issue.

How does this work in Lazarus?  Do finalization code execute before
the lazarus application's main eventloop terminates?


Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-pascal mailing list