Skip to content

Commit

Permalink
One more GC block
Browse files Browse the repository at this point in the history
  • Loading branch information
bacek committed Apr 16, 2011
1 parent 99cfc8c commit 36c5eb1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/packfile/api.c
Expand Up @@ -1463,10 +1463,19 @@ PMC *
Parrot_pf_get_packfile_pmc(PARROT_INTERP, ARGIN(PackFile *pf))
{
ASSERT_ARGS(Parrot_pf_get_packfile_pmc)
PMC * const ptr = Parrot_pmc_new(interp, enum_class_PtrObj);
PMC *ptr;

/* We have to block GC here. */
/* XXX We should never-ever have raw PackFile* laying around */
/* XXX But it require a lot of effort to cleanup codebase */
Parrot_block_GC_mark(interp);

ptr = Parrot_pmc_new(interp, enum_class_PtrObj);
VTABLE_set_pointer(interp, ptr, pf);
PTROBJ_SET_MARK(interp, ptr, mark_packfile_pmc);

Parrot_unblock_GC_mark(interp);

/* TODO: We shouldn't need to register this here. But, this is a cheap
fix to make sure packfiles aren't getting collected prematurely */
Parrot_pmc_gc_register(interp, ptr);
Expand Down

0 comments on commit 36c5eb1

Please sign in to comment.