Protect deleted key and value from GC.

This commit is contained in:
Masamitsu MURASE
2012-07-28 21:00:47 +09:00
parent 7f8076ef90
commit b48cfea736
+2
View File
@@ -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);
}