> (define o (get-foreign-wrapper ...)) ; a will has been created for o, which will delete the underlying C data> (define t (make-table weak-values: #t))> (table-set! t 'o o)
> (set! o #f)> (##gc)At this point your foreign wrapper is not strongly reachable anymore. The garbage collection has triggered your will, which has freed the C object wrapped by o. But you can still
> (println (table-ref t 'o))And get an access to invalid memory or a segmentation fault.Wait, what is returned by get-foreign-wrapper and are other references to it sticking around at that GC?