From: hapalibashi on
I have incoming asynchronous events that are posted using wxPostEvent
(this, myEvent). In onMyEvent I am writing to a wxRichTextCtrl.

Occasionally the data written to wxRichTextCtrl is *interleaved* e.g.

onMyEvent writes "hello how are you?" to the wxRichTextCtrl
onMyEvent writes "yeah I'm ok" to the wxRichTextCtrl

wxRichTextCtrl shows "hello how yeah I'm ok are you?"

This suggested that the onMyEvent is called multiple times in
parallel. However, it is my understanding that there is *one* message
queue and that messages are processed *one at a time* so this should
not happen!

Does this mean there is an issue internal to wxRichTextCtrl and it
cannot be used like this?

From: Vadim Zeitlin on
On 2009-10-29, hapalibashi(a)googlemail.com <hapalibashi(a)googlemail.com> wrote:
> I have incoming asynchronous events that are posted using wxPostEvent
> (this, myEvent). In onMyEvent I am writing to a wxRichTextCtrl.
>
> Occasionally the data written to wxRichTextCtrl is *interleaved* e.g.
>
> onMyEvent writes "hello how are you?" to the wxRichTextCtrl
> onMyEvent writes "yeah I'm ok" to the wxRichTextCtrl
>
> wxRichTextCtrl shows "hello how yeah I'm ok are you?"
>
> This suggested that the onMyEvent is called multiple times in
> parallel. However, it is my understanding that there is *one* message
> queue and that messages are processed *one at a time* so this should
> not happen!

Yes, it really shouldn't. The only explanation I can see is that adding
the text to wxRichTextCtrl somehow results in reentering the event loop and
so dispatching another pending event. This would be the case if the
notorious wxYield() function were used in it but I hope this isn't the
case...

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/