summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2022-05-05 16:08:24 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2022-05-05 17:37:07 -0400
commit7448afccb32f78115c05af03421984aa2f2aaf58 (patch)
tree929ee02d2bfe7adc7b0ccbea58a5192d6113d9b8 /internal
parent4acafdf6328cf7ae2b61faa1e309a63a598a7029 (diff)
downloadruby-7448afccb32f78115c05af03421984aa2f2aaf58.tar.gz
Fix potential GC issue while iterating over weak refs
While walking over the list of subclasses for `include` and friends, we check whether the subclass is a garbage object. After the check, we allocate objects which might trigger GC and make the subclass garbage, even though before the allocation the subclass was not garbage. This is a sort of time-of-check-time-of-use issue. Fix this by saving the weak reference to a local variable, upgrading it to a strong reference while we do the allocation. It makes the code look slightly nicer even if it doesn't fix any runtime issues.
Diffstat (limited to 'internal')
0 files changed, 0 insertions, 0 deletions