[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.0-98-gca33b5

From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.0-98-gca33b50
Date: Sun, 13 Mar 2011 15:11:21 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

The branch, stable-2.0 has been updated
       via  ca33b501a93f8de389c1e3e1bc987f63b6912029 (commit)
      from  b075a6d766c2ffe7c575b63648d8ae0d51b5dd3a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ca33b501a93f8de389c1e3e1bc987f63b6912029
Author: Ludovic Courtès <address@hidden>
Date:   Sun Mar 13 16:09:55 2011 +0100

    Work around weak-value hash table bug in `define-wrapped-pointer-type'.
    * module/system/foreign.scm (define-wrapped-pointer-type)[wrap]: Use
      `hash-ref' and `hash-set!' instead of `hash-create-handle!' and


Summary of changes:
 module/system/foreign.scm |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/module/system/foreign.scm b/module/system/foreign.scm
index 781e793..a657d44 100644
--- a/module/system/foreign.scm
+++ b/module/system/foreign.scm
@@ -190,9 +190,12 @@ which does the reverse.  PRINT must name a user-defined 
object printer."
                ;; PTR1 == PTR2 <-> (eq? (wrap PTR1) (wrap PTR2)).
                (let ((ptr->obj (make-weak-value-hash-table 3000)))
                  (lambda (ptr)
-                   (let ((key+value (hash-create-handle! ptr->obj ptr #f)))
-                     (or (cdr key+value)
-                         (let ((o (%wrap ptr)))
-                           (set-cdr! key+value o)
-                           o))))))
+                   ;; XXX: We can't use `hash-create-handle!' +
+                   ;; `set-cdr!' here because the former would create a
+                   ;; weak-cdr pair but the latter wouldn't register a
+                   ;; disappearing link (see `scm_hash_fn_set_x'.)
+                   (or (hash-ref ptr->obj ptr)
+                       (let ((o (%wrap ptr)))
+                         (hash-set! ptr->obj ptr o)
+                         o)))))
              (set-record-type-printer! type-name print)))))))

GNU Guile

reply via email to

[Prev in Thread] Current Thread [Next in Thread]