[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.9-235-gc6a26

From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-235-gc6a2691
Date: Wed, 12 Mar 2014 06:42:35 +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  c6a2691fff2863209729aba5f54e3f874bbbf1c4 (commit)
      from  3aecd36464b1d916991bcc57acd6ec42e1cabbdc (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 c6a2691fff2863209729aba5f54e3f874bbbf1c4
Author: David Thompson <address@hidden>
Date:   Sat Mar 8 17:15:52 2014 -0500

    Test for deleted weak pairs in hash-for-each.
    * libguile/hashtab.c (scm_internal_hash_for_each_handle): Test for
      deleted weak pairs.
    * test-suite/tests/hash.test: Add test case.


Summary of changes:
 libguile/hashtab.c         |    4 +++-
 test-suite/tests/hash.test |   12 ++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/libguile/hashtab.c b/libguile/hashtab.c
index 9107ce5..44db051 100644
--- a/libguile/hashtab.c
+++ b/libguile/hashtab.c
@@ -1464,7 +1464,9 @@ scm_internal_hash_for_each_handle (scm_t_hash_handle_fn 
fn, void *closure,
          handle = SCM_CAR (ls);
          if (!scm_is_pair (handle))
            SCM_WRONG_TYPE_ARG (SCM_ARG3, buckets);
-         fn (closure, handle);
+          if (!SCM_HASHTABLE_WEAK_P (table)
+              || !SCM_WEAK_PAIR_DELETED_P (handle))
+            fn (closure, handle);
          ls = SCM_CDR (ls);
diff --git a/test-suite/tests/hash.test b/test-suite/tests/hash.test
index 64d10bb..4c21d71 100644
--- a/test-suite/tests/hash.test
+++ b/test-suite/tests/hash.test
@@ -347,3 +347,15 @@
     (pass-if (equal? 2 (hash-count (lambda (k v)
                                      (string? v)) table)))))
+;;; weak key hash table
+(with-test-prefix "weak key hash table"
+  (pass-if "hash-for-each after gc"
+    (let ((table (make-weak-key-hash-table)))
+      (hashq-set! table (list 'foo) 'bar)
+      (gc)
+      ;; Iterate over deleted weak ref without crashing.
+      (unspecified? (hash-for-each (lambda (key value) key) table)))))

GNU Guile

reply via email to

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