TApplication.Destroy calls ProcessAsyncCallQueue lazarus / 8-Other ---------------------------------------------------------------------- Hansi · 2009-01-03 17:43 Hi! I'm working on a multi-threaded application which also utilizes QueueAsyncCall (instead of Synchronize). If I close the application window while an event is in this asynchronous queue, an exception occurs. After some investigations I found the problem to be that TApplication.Destroy calls ProcessAsyncCallQueue. When closing the window, all widgets are Destroy()ed. After that, TApplication.Destroy is executed. This calls ProcessAsyncCallQueue which executes the events in the asynchronous queue. Since these are class methods of objects, which have been destroyed before (or refer to such), this is a problem. So, my question is: is there a problem in my application setup or is the problem in the LCL? How can I solve this problem? Thanks   Hansi ---------------------------------------------------------------------- Marc · 2009-01-04 02:24 This is always tricky. In the mainform.OnClose, terminate your threads and make sure the queue is empty.