[Lazarus] Lazarus application crash. Is PostMessage thread safe?

Giuliano Colla giuliano.colla at fastwebnet.it
Thu Feb 11 13:16:47 CET 2016


Il 10/02/2016 21:13, Giuliano Colla ha scritto:
> I don't believe that there's an easy way to protect 
> Application.ProcessMessages from recursion unless someone is willing 
> to debug and patch Glib (which is used not only by Qt, but also from 
> GTK, if I'm not wrong).

A snippet from gmain.c:
> #if 0
>   /* If recursing, finish up current dispatch, before starting over */
>   if (context->pending_dispatches)
>     {
>       if (dispatch)
>     g_main_dispatch (context, &current_time);
>
>       UNLOCK_CONTEXT (context);
>       return TRUE;
>     }
> #endif
>

It would appear that they realized the dispatch recursion problems but 
where unable to find a clean solution!
This code appears both in glib-2.28.8 (the one coming with CentOs 6, 
which I've been using) and in the current version i.e. glib-2.47.5.
My feeling is that it's been left there as a reminder that the matter is 
still pending.
I'm afraid we must live with it.

Giuliano






More information about the Lazarus mailing list