Hi Kieron,<br><br>As is, I can't do much on the MrEd Designer side, but maybe Matthew will have a much better understanding of what the problem is on the Racket side with the below information (there's nothing here that says where the bug might appear in MED, as you noticed).<br>
If possible, try to reduce your project to a minimalist one where the bug still appears, then send it to me.<br>Does the bug appear when you do nothing? If not, what actions do you do before it appears? Does simply loading the project make the bug appear?<br>
<br>Cheers,<br>Laurent<br><br><div class="gmail_quote">On Mon, Jun 18, 2012 at 8:24 AM, Kieron Hardy <span dir="ltr"><<a href="mailto:kieron.hardy@gmail.com" target="_blank">kieron.hardy@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br><br>On Windows Vista (64-bit on quad-core CPU), MrEd-Designer randomly crashes when working on a large and somewhat complex UI. At the command prompt I get a trace, and the last one included:<br>
<br>ptr-ref: contract violation<br>
expected: (and/c cpointer? (not/c (lambda (p) (pointer-equal? p #f))))<br> given: #f<br> argument position: 1st<br> other arguments:<br> #<ctype:scheme><br> context:<br> ...\collects\mred\private\wx\win32\wndclass.rkt:43:0: set-hwnd-wx!<br>
...\collects\racket\private\class-internal.rkt:<a href="tel:3960" value="+333960" target="_blank">3960</a>:0: continue-make-object<br> ...\collects\mred\private\wx\win32\panel.rkt:16:2<br> ...\collects\racket\private\class-internal.rkt:<a href="tel:3960" value="+333960" target="_blank">3960</a>:0: continue-make-object<br>
...\collects\mred\private\wx\win32\panel.rkt:98:2<br>
...\collects\racket\private\class-internal.rkt:<a href="tel:3960" value="+333960" target="_blank">3960</a>:0: continue-make-object<br> ...\collects\mred\private\wxwindow.rkt:14:6<br> ...\collects\racket\private\class-internal.rkt:<a href="tel:3960" value="+333960" target="_blank">3960</a>:0: continue-make-object<br>
...\collects\mred\private\wxitem.rkt:34:6<br>
...\collects\racket\private\class-internal.rkt:<a href="tel:3960" value="+333960" target="_blank">3960</a>:0: continue-make-object<br> ...\collects\mred\private\wxpanel.rkt:69:4<br> ...\collects\racket\private\class-internal.rkt:<a href="tel:3960" value="+333960" target="_blank">3960</a>:0: continue-make-object<br>
...\collects\racket\private\class-internal.rkt:<a href="tel:3960" value="+333960" target="_blank">3960</a>:0: continue-make-object<br>
...\collects\racket\private\class-internal.rkt:<a href="tel:3960" value="+333960" target="_blank">3960</a>:0: continue-make-object<br> ...\collects\racket\private\class-internal.rkt:<a href="tel:3960" value="+333960" target="_blank">3960</a>:0: continue-make-object<br>
...\collects\racket\private\class-internal.rkt:<a href="tel:3960" value="+333960" target="_blank">3960</a>:0: continue-make-object...<br>
<br>Where wndclass.rkt contains:<br><br>(define (set-hwnd-wx! hwnd wx)<br> (let* ([c (GetWindowLongPtrW hwnd GWLP_USERDATA)]<br> [v (ptr-ref c _racket)])<br> (vector-set! v 0 (make-weak-box wx))))<br><br>and two functions that invoke SetWindowLongPtrW GWLP_USERDATA:<br>
<br>;; call in atomic mode:<br>(define (register-hwnd! hwnd)<br> (hash-set! all-hwnds (cast hwnd _pointer _intptr) #t)<br> (let ([c (malloc-immobile-cell (vector #f #f #f))])<br> (void (SetWindowLongPtrW hwnd GWLP_USERDATA c))))<br>
<br>and:<br><br>;; call in atomic mode:<br>(define (unregister-hwnd! hwnd)<br> (let ([c (GetWindowLongPtrW hwnd GWLP_USERDATA)])<br> (when c<br> (free-immobile-cell c)<br> (SetWindowLongPtrW hwnd GWLP_USERDATA #f))<br>
(hash-remove! all-hwnds (cast hwnd _pointer _intptr))))<br><br>Since the crashes occur at random it seems likely that there is some sort of race condition (perhaps caused by the register and/or unregister functions not being called in 'atomic' mode), but my unfamiliarity with the internals of both MrEd-Designer and the GUI components of Racket leave me at a bit of a loss at how to proceed debugging this problem. Any hints or tips would be very welcome.<br>
<br>Cheers,<br><br>Kieron.<br><br>
<br>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br>