Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
class.c: store the stash in the constructor CV stash slot
This code previously stored the stash for the class in the CV's any_cv slot, and marked that to be released when the CV is released. But it does not bump the reference count of the stash that I can see. When I tried releasing the constructor SV while working on #22169 I found perl would crash, incrementing the stash reference count prevents that, but leaves us with a reference loop. But it turns out that CVs already have a slot to store their stash in and an API that correctly handles reference counting for that slot. So use CvSTASH_set()/CvSTASH() to manage the stash for "$class::new" methods.
- Loading branch information