Permalink
Browse files

Protect deleted key and value from GC.

  • Loading branch information...
1 parent 7f8076e commit b48cfea73619f0fbf64324209f5fa5d7cc725856 @masamitsu-murase committed Jul 28, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/hash.c
View
@@ -568,7 +568,9 @@ mrb_hash_shift(mrb_state *mrb, mrb_value hash)
if (!kh_exist(h,k)) continue;
delKey = kh_key(h,k);
+ mrb_gc_protect(mrb, delKey);
delVal = mrb_hash_delete_key(mrb, hash, delKey);
+ mrb_gc_protect(mrb, delVal);
return mrb_assoc_new(mrb, delKey, delVal);
}

0 comments on commit b48cfea

Please sign in to comment.