fix ffi retain of callbacks

The FFI's weak table of callback procedures (to map Racket procedures
to FFI callback objects) suffered from the classic key-in-value
problem.

Closes PR 12228, probably

Merge to 5.2
(cherry picked from commit 8bd81f4806)
This commit is contained in:
Matthew Flatt 2011-10-09 08:51:37 -06:00 committed by Eli Barzilay
parent fd03fb8575
commit 6fe0b33625
2 changed files with 2 additions and 2 deletions

View File

@ -446,7 +446,7 @@
(lambda (x)
(and x
(let ([cb (ffi-callback (wrap x) itypes otype abi atomic? async-apply)])
(cond [(eq? keep #t) (hash-set! held-callbacks x cb)]
(cond [(eq? keep #t) (hash-set! held-callbacks x (make-ephemeron x cb))]
[(box? keep)
(let ([x (unbox keep)])
(set-box! keep

View File

@ -67,7 +67,7 @@
(define (can-try-atomic?) (and (freezer-box) (not (in-try-atomic?))))
;; prevent GC of handler while it's installed:
(define saved-ptrs (make-hash))
(define saved-ptrs (make-hasheq))
(define (try-atomic thunk default
#:should-give-up? [should-give-up?