On 2011-09-21 15:38:08 +0200, cobines wrote:
> Your thread calls OnTerminate via Synchronize and waits until the
> callback finishes. In the callback you call Thread.Destroy which waits
> until the thread finishes. It is a deadlock.
> 
> Other than using FreeOnTerminate=True, maybe periodically check from
> the main thread the status of the thread. If it is finished then
> destroy, but don't do it from OnTerminate.
> 
> --
> cobines
> 

Well, the "best" way I found is to create a Timer that checks if the
thread is terminated, then destroy it.

I don't like this. It would be better if the thread can communicate the
main form that it has finished, then the main form can destroy it,
without using a Timer.

-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to