summaryrefslogtreecommitdiffhomepage
path: root/src/proc.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-09-01 06:50:24 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-09-01 06:51:59 +0900
commitab99e2c293167935033016750c010047a2aba76a (patch)
tree56ea8a959823904f28192749500cd8159fd581e4 /src/proc.c
parent57610091ced4163d577f813c7d32581be8ba1d9c (diff)
downloadmruby-ab99e2c293167935033016750c010047a2aba76a.tar.gz
mruby-ab99e2c293167935033016750c010047a2aba76a.zip
Avoid copying over initialized procs using `initialize_copy`; fix #3803
It may be better to raise exceptions, but CRuby doesn't.
Diffstat (limited to 'src/proc.c')
-rw-r--r--src/proc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/proc.c b/src/proc.c
index 96b080f9e..10a2c4f33 100644
--- a/src/proc.c
+++ b/src/proc.c
@@ -139,6 +139,10 @@ mrb_proc_cfunc_env_get(mrb_state *mrb, mrb_int idx)
void
mrb_proc_copy(struct RProc *a, struct RProc *b)
{
+ if (a->body.irep) {
+ /* already initialized proc */
+ return;
+ }
a->flags = b->flags;
a->body = b->body;
if (!MRB_PROC_CFUNC_P(a) && a->body.irep) {