[Lazarus] Lazarus application crash. Is PostMessage thread safe?
C Western
l at c-m-w.me.uk
Wed Feb 10 22:12:39 CET 2016
On 10/02/16 20:13, Giuliano Colla wrote:
> Il 10/02/2016 13:48, zeljko ha scritto:
>>> I believe
>>> that Application.ProcessMessages should protect itself too, avoiding to
>>> handle more than once the same message.
>>
>> But where ? In LCL or per widgetset ?
>
> I skimmed through the backtrace. It would appear that the recursion
> originates in g_main_context_iteration() which calls
> g_main_context_dispatch(), which will continue to dispatch the same
> message. 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). Personally I give up.
>
> Giuliano
>
My understanding is Application.ProcessMessages has to be reentrant for
the clipboard to work, at least under X, as clipboard content is
retrieved by receiving messages. See
http://bugs.freepascal.org/view.php?id=26242 for a (fixed) bug that
showed this up. The sequence is something along the lines of (for
example) ProcessMessages -> Handle paste button -> clipboard ->
ProcessMessages.
Colin
More information about the Lazarus
mailing list