[Lazarus] How to PostMessage to object?

Henry Vermaak henry.vermaak at gmail.com
Thu Jun 9 13:28:12 CEST 2011


On 09/06/11 12:00, Mattias Gaertner wrote:
>
>
> Henry Vermaak <henry.vermaak at gmail.com> hat am 9. Juni 2011 um 12:12
> geschrieben:
>
>  > On 09/06/11 11:01, Mattias Gaertner wrote:
>  > >
>  > >
>  > > Michael Schnell <mschnell at lumino.de> hat am 9. Juni 2011 um 11:46
>  > > geschrieben:
>  > >
>  > > > On 06/09/2011 10:58 AM, Henry Vermaak wrote:
>  > > > > You will corrupt the linked list that QueueAsyncCall() uses
> when you
>  > > > > call it from multiple threads, so you _must_ protect it.
>  > > > As QueueAsyncCall is specified exactly for this use, it needs to take
>  > > > care of this issue internally. Otherwise it obviously is buggy. I
> trust
>  > > > that the LCL developers did a decent job.
>  > >
>  > > The only "specification" I found for TApplication.QueueAsyncCall is the
>  > > fpdoc entry:
>  > >
>  > > Insert a given asynchronous call into the queue
>  > >
>  > > Why do you think it is thread safe?
>  >
>  > Do you propose that QueueAsyncCall throws an exception if it's used from
>  > outside the main thread? Otherwise adding a critical section to all the
>  > async queue methods is in order.
>
> I made it thread safe. Please test.

In TApplication.Destroy there is another call to ProcessAsyncCallQueue 
further down (line 170).  System.DoneCriticalSection(FAsyncCall.CritSec) 
needs to be moved after it.

Henry




More information about the Lazarus mailing list