[Lazarus] Lazarus application crash. Is PostMessage thread safe?
Michael Schnell
mschnell at lumino.de
Mon Feb 15 11:54:53 CET 2016
On 02/13/2016 12:27 PM, Giuliano Colla wrote:
>
> At least under Qt widgetset, it may happen that calling
> Application.ProcessMessages from within a Message Handler will cause
> the same message which was being processed to be processed again, the
> handler called again and Application.ProcessMessages being called
> again, thus originating an endless loop and a consequent stack overflow.
When calling Application.ProcessMessages from within a Message Handler
the *next* event in the event queue should be handled. If
*the*event*already*being*handled* pops up again, that would be a bug.
But of course "the same" message might have pushed by some thread and
also needs handling. Here the same handler might be called recursively.
This of course does need additional stack space, but not infinitely .
>
> The result is to make Application.ProcessMessage not 100% reentrant,
> because of a Glib2 bug.
Would you suggest not to handle "the same" event ? How should you detect
that its the event already in the works or the next occurrence ?
-Michael
More information about the Lazarus
mailing list