[racket] Asynchronously inserting text to editor%

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Aug 26 08:25:37 EDT 2014

The real issue here is that the implementation of text% is not
thread-safe (nor are the GUI controls generally speaking). So when you
modify them from two threads, strange things can happen.

Robby

On Tue, Aug 26, 2014 at 6:11 AM, Eli Barzilay <eli at barzilay.org> wrote:
> On Tue, Aug 26, 2014 at 6:46 AM, Dmitry Cherkassov
> <dcherkassov at gmail.com> wrote:
>> Thanks for your reply. I've found that `disable`-ing canvas of text editor
>> when inserting works too. But with downside that you cant select anything or
>> move the cursor when bulk of text strings are inserted.
>
> Well, that's why I said that you're much better off just doing the
> callback -- even if you disable things, you're likely to get the same
> problem later on.  OTOH, doing a callback is easy, and can be done from
> a different thread with no issues, since the actual addition happens
> when the GUI is prepared to do so.
>
> --
>           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                     http://barzilay.org/                   Maze is Life!
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.