Re: GTK2::Button retrieved from Tie::IxHash hash value does not render



On Fri, Jul 22, 2011 at 10:03 AM, Emmanuel Rodriguez
<emmanuel rodriguez gmail com> wrote:
There's something odd going on there with the reference to the button.

Right. I guess that $vbox->add is an XS function?
You have to do extra work to correctly access tied magic stuff from XS.

Here's what Devel::Peek shows for a value returned from a "plain" hash:

SV = RV(0x6b7e18) at 0x792110
  REFCNT = 1
  FLAGS = (ROK)
  RV = 0x65db30
  SV = PVHV(0x6b7850) at 0x65db30
  ...

and for a value returned from a tied hash (such as Tie::IxHash):

SV = PVLV(0x6b0860) at 0x7925e0
  REFCNT = 1
  FLAGS = (GMG,SMG,RMG)
  IV = 0
  NV = 0
  PV = 0
  MAGIC = 0x79a440
    MG_VIRTUAL = &PL_vtbl_packelem
    MG_TYPE = PERL_MAGIC_tiedelem(p)
    MG_FLAGS = 0x02
      REFCOUNTED
  ...

That's why assigning the value to a dummy variable "works": it clears
the tie magic.


Cheers, Roderich



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]