Thanks for taking the time to reproduce it, Alex. I assume you saw nothing 
wrong with the overall approach I took for the table, outside of your 
suggestion to use queue-callback.

I had already tried using queue-callback in my actual program, and got no 
improvement in behavior. I just tried it again with this test program, and 
was still able to make it fail. I'll go ahead and report it as a bug.

I'm also open to suggestions on how I might coax more information out of 
the system about the failure. I just found the tutorial on contributing to 
Racket, I'll read through that and see how hard it is to debug the gui 
library itself.


On Sunday, October 14, 2018 at 7:57:23 PM UTC-4, Alex Harsanyi wrote:

> I get the same error too if I run your attached program and just click on 
> the "All" and "None" buttons a few times.  The problem seems to be with 
> doing GUI container operations that take a long time (adding the message% 
> objects) inside an event callback.  To work around this, you can use 
> queue-callback, that is, replace the code that calls `show-selected-columns`
>
>     (when changed
>       (show-selected-columns)))
>
> with
>
>     (when changed
>       (queue-callback (lambda () (show-selected-columns)))
>  
> I also think it might be worth reporting this as a bug in the GitHub 
> racket/gui project.
>
> Regards,
> Alex.
>
> On Monday, October 15, 2018 at 3:50:20 AM UTC+8, Dan Muller wrote:
>>
>> DrRacket 7, running on Windows 10 version 1803
>>
>> I've been working on a GUI program that needs to show a table of data, 
>> the columns of which change according to checkbox selections. The 
>> checkboxes are arranged in several groups, each of which has "All" and 
>> "None" buttons to allow quick checking and clearing of all buttons in that 
>> group.
>>
>> If I stress the program a bit by punching checkboxes and buttons more or 
>> less randomly, it eventually fails. 
>> I was able to come up with a smaller program that exhibits the same 
>> behavior. I've attached it to this message. 
>>
>> Running it from the command line with errortrace gives the most 
>> information.
>>
>> $ racket -l errortrace -t failure.rkt
>> ptr-ref: contract violation
>>   expected: (and/c cpointer? (not/c (lambda (p) (pointer-equal? p #f))))
>>   given: #f
>>   argument position: 1st
>>   other arguments...:
>>    #<ctype:scheme>
>>   errortrace...:
>>    C:\Users\danm\Documents\Racket\NMSRecipes\failure.rkt:124:6: (new 
>> message% (parent column) (label (number->string item)))
>>    C:\Users\danm\Documents\Racket\NMSRecipes\failure.rkt:123:4: (for 
>> ((item column-data)) (new message% (parent column) (label (number->string 
>> ....))))
>>    C:\Users\danm\Documents\Racket\NMSRecipes\failure.rkt:130:4: 
>> (make-column (format "Column ~a" i) (list-ref column-data i))
>>    C:\Users\danm\Documents\Racket\NMSRecipes\failure.rkt:129:2: (for ((i 
>> selected-indexes)) (make-column (format "Column ~a" i) (list-ref 
>> column-data i)))
>>
>> Sometimes it can take a while to get the error; it's quite random.
>>
>> I'm usually running it in DrRacket, but I've also tried it as a 
>> standalone executable, with the same result.
>>
>> The DrRacket IDE isn't quite right after this happens, either. The 
>> program will fail (with the same error) immediately, if I can even restart 
>> it. Sometimes a separate black window opens, showing a similar error. The 
>> IDE usually cannot be exited normally. Most of the text editing functions 
>> still work, though.
>>
>> Suggestions for workarounds are welcome. I'd be happy to open an issue on 
>> GitHub, but wanted to first get opinions on whether there's something wrong 
>> with my code.
>> Also, I'm not sure which of the Racket projects it rightly belongs to, 
>> since the error reporting doesn't usefully refer to anything outside of my 
>> own code.
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to