Skip to content

Protect deleted key and value from GC. #398

Merged
merged 1 commit into from Jul 28, 2012
+2 −0
View
2 src/hash.c
@@ -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);
}
Something went wrong with that request. Please try again.