[racket-dev] List-box% infinite loop (was: Bug report not confirmed)
I have the impression that invoking methods like 'set' aren't supposed to
invoke callbacks like that, generally speaking.
Robby
On Sun, Sep 15, 2013 at 9:58 AM, Laurent <laurent.orseau at gmail.com> wrote:
> On Sun, Sep 15, 2013 at 4:34 PM, Robby Findler <
> robby at eecs.northwestern.edu> wrote:
>
>>
>> What was the issue?
>>
>
> It was an infinite loop triggered by a particular callback in list-box%:
>
> #lang racket/gui
>
> (define my-frame (new frame% [label "my-frame"]
> [min-width 200] [min-height 200]))
>
> (define lb (new list-box%
> [parent my-frame]
> [label "values"]
> [choices '("a" "b")]
> [callback (λ(lb ev)
> (displayln (send ev get-event-type))
> (send lb clear)
> (send lb set '("b"))
> )]))
>
> (send my-frame show #t)
>
> Click on "b", this will trigger infinite events
>
> It's actually the combination of the callback calling `clear' and `set'
> that triggers this infinite loop.
> The problem is easily solved by removing `(clear)', which is redundant
> with `set' anyway (which I hadn't understood at first).
>
> Laurent
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20130915/692269dc/attachment.html>