Skip Menu |

This queue is for tickets about the Inline-Struct CPAN distribution.

Report information
The Basics
Id: 99146
Status: resolved
Worked: 2 hours (120 min)
Priority: 0/
Queue: Inline-Struct

People
Owner: ETJ [...] cpan.org
Requestors: heinz.knutzen [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Can't retrieve reference from struct member
Date: Thu, 25 Sep 2014 23:28:48 +0200
To: bug-Inline-Struct [...] rt.cpan.org
From: Heinz Knutzen <heinz.knutzen [...] gmail.com>
I want to use Inline::Struct as a memory efficient replacement for small hashes with a fixed set of keys. The values of these hashes are references to other hashes. Currently Inline::Struct fails if I try to retrieve a reference from a struct. This example program ============================================ use Inline C => <<'END', STRUCTS => 1; struct Foo { SV *hash; }; END my $o = Inline::Struct::Foo->new(); $o->hash({ a => { b => 'c' } }); print $o->hash()->{a}->{b}, "\n"; ============================================ fails with Can't use an undefined value as a HASH reference at inline-struct-SV.pl line 9. Attempt to free unreferenced scalar: SV 0x9fbed98 at inline-struct-SV.pl line 9. Used versions: - Inline-Struct-0.11 - Perl v5.18.2
Reason for this was the hash you passed in wasn't having its refcnt incremented. This is fixed (with special handling for SV* member types) in commit a48f0a8e72aed596c42fba1b2fcebaaa022ce1ca. I'm marking this resolved, please test and reopen if problems.
Subject: Re: [rt.cpan.org #99146] Can't retrieve reference from struct member
Date: Fri, 17 Oct 2014 22:15:42 +0200
To: bug-Inline-Struct [...] rt.cpan.org
From: Heinz Knutzen <heinz.knutzen [...] gmail.com>
Great work. Thank you! More reports will come.