Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 39dd28f9eafb1932132c9d1099532d371c913923
      
https://github.com/Perl/perl5/commit/39dd28f9eafb1932132c9d1099532d371c913923
  Author: Tony Cook <t...@develop-help.com>
  Date:   2024-06-20 (Thu, 20 Jun 2024)

  Changed paths:
    M class.c

  Log Message:
  -----------
  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.



To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to