Skip to content

Commit

Permalink
[gc] fix the Coroutine GC bug #1108
Browse files Browse the repository at this point in the history
 Coroutine.clone needs to reset the GC flags
  • Loading branch information
Reini Urban committed Nov 9, 2014
1 parent f177f98 commit 44bdc53
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pmc/coroutine.pmc
Expand Up @@ -144,10 +144,13 @@ Clones the coroutine.

PObj_custom_mark_destroy_SETALL(ret);

/* first copy the struct, Parrot_str_copy may cause GC */
memcpy((Parrot_Coroutine_attributes *)PMC_data(ret),
(Parrot_Coroutine_attributes *)PMC_data(SELF),
sizeof (Parrot_Coroutine_attributes));
PObj_flags_SETTO(ret, PObj_get_FLAGS(SELF));
(Parrot_Coroutine_attributes *)PMC_data(SELF),
sizeof (Parrot_Coroutine_attributes));
/* but unlike with Sub we do share the arg_info struct */

PObj_flags_SETTO(ret, PObj_get_FLAGS(SELF) & ~PObj_GC_all_FLAGS);

return ret;
}
Expand Down

0 comments on commit 44bdc53

Please sign in to comment.