Re: HV and SV problem

2025-06-07 Thread Gavin Smith
On Sat, Jun 07, 2025 at 09:51:50AM +0200, Patrice Dumas wrote: > On Fri, Jun 06, 2025 at 07:27:55PM +0100, Gavin Smith wrote: > Indeed, that's the issue, thanks for the analysis. What confused me is > that in Perl code, it does not happens that way, but I think that it is > because the Perl scalar

Re: HV and SV problem

2025-06-07 Thread Patrice Dumas
On Sat, Jun 07, 2025 at 09:51:50AM +0200, Patrice Dumas wrote: > I found newSVsv, which seems to copy the SV, including the blessing and > the 'reference' to the HV, this could be an alternative to keeping the > HV in C and calling newRV and blessing each time a reference is needed. > I still need

Re: HV and SV problem

2025-06-07 Thread Gavin Smith
On Fri, Jun 06, 2025 at 07:27:56PM +0100, Gavin Smith wrote: > Then I suspected something was strange with the way the data structures > were constructed. I suspect it would be hard to replicate the loss without > using XS. After reading through "man perlref" again, I found the 'refaliasing' fea

Re: HV and SV problem

2025-06-07 Thread Patrice Dumas
On Fri, Jun 06, 2025 at 07:27:55PM +0100, Gavin Smith wrote: > In element_to_perl_hash, commit 359b73825d2 changed: > > - sv = newRV_inc ((SV *) e->parent->hv); > - hv_store (e->hv, "parent", strlen ("parent"), sv, HSH_parent); > + sv = SvREFCNT_inc ((SV *) e->parent->sv); > +