Skip to content

Commit

Permalink
Make sure the argument to cache_method is always rooted even if ano…
Browse files Browse the repository at this point in the history
…ther thread

updated `m->sig`.

This causes a corruption with multi threading
  • Loading branch information
yuyichao committed Dec 10, 2015
1 parent 5f7d7d0 commit 9f4a26e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,10 @@ static jl_function_t *jl_mt_assoc_by_type(jl_methtable_t *mt, jl_datatype_t *tt,
JL_GC_POP();
return func;
}
jl_function_t *res = cache_method(mt, tt, func, m->sig, jl_emptysvec, m->isstaged);
// make sure the argument is rooted in `cache_method`
// in case another thread changed it.
newsig = m->sig;
jl_function_t *res = cache_method(mt, tt, func, newsig, jl_emptysvec, m->isstaged);
JL_GC_POP();
return res;
}
Expand Down

0 comments on commit 9f4a26e

Please sign in to comment.