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



On Sat, Jul 23, 2011 at 1:35 AM, Kevin Ryde <user42 zip com au> wrote:
Clears as in runs the magic I suppose, so as to reach the ixhash
FETCH(). ÂDoes that mean gperl_get_object() and friends ought to
SvGETMAGIC() or something before looking into an sv?

Dunno. I instrumented gperl_get_object_check (where the "is not of
type Gtk2::Widget"
comes from). It first checks the argument sv = $button{somekey} with

  SvROK(sv)

which fails. At that point we have

SV = PVLV(0x170c780) at 0x19ccf50
  REFCNT = 1
  FLAGS = (TEMP,GMG,SMG,RMG)
  IV = 0
  NV = 0
  PV = 0
  MAGIC = 0x1bbc1e0
    MG_VIRTUAL = &PL_vtbl_packelem
    MG_TYPE = PERL_MAGIC_tiedelem(p)
    MG_FLAGS = 0x02
      REFCOUNTED
    MG_OBJ = 0x18c69d8
        SV = IV(0x18c69c8) at 0x18c69d8
          REFCNT = 2
          FLAGS = (ROK)
          RV = 0x18fe140
            SV = PVAV(0x1900420) at 0x18fe140
              REFCNT = 1
              FLAGS = (OBJECT)
              STASH = 0x18528e0 "Tie::IxHash"
  ...

If I intentionally ignore this check the next check is

  sv_derived_from(sv, "Gtk2::Widget")

which passes. Interestingly this has modified sv as a side effect:

SV = PVLV(0x170c780) at 0x19ccf50
  REFCNT = 1
  FLAGS = (TEMP,SMG,RMG,ROK)
  IV = 0
  NV = 0
  RV = 0x19cf3e8
    SV = PVHV(0x183a0c0) at 0x19cf3e8
      REFCNT = 3
      FLAGS = (OBJECT,RMG,SHAREKEYS)
      MAGIC = 0x1badaf0
        MG_VIRTUAL = 0
        MG_TYPE = PERL_MAGIC_ext(~)
        MG_PTR = 0x16d5020 ""
      STASH = 0x18bc328 "Gtk2::Button"
      ARRAY = 0x0
      KEYS = 0
      FILL = 0
      MAX = 7
      RITER = -1
      EITER = 0x0
  PV = 0x19cf3e8 ""
  CUR = 0
  LEN = 0
  MAGIC = 0x1bbc1e0
    MG_VIRTUAL = &PL_vtbl_packelem
    MG_TYPE = PERL_MAGIC_tiedelem(p)
    MG_FLAGS = 0x06
      REFCOUNTED
      GSKIP
    MG_OBJ = 0x18c69d8
        SV = IV(0x18c69c8) at 0x18c69d8
          REFCNT = 2
          FLAGS = (ROK)
          RV = 0x18fe140
            SV = PVAV(0x1900420) at 0x18fe140
              REFCNT = 1
              FLAGS = (OBJECT)
              STASH = 0x18528e0 "Tie::IxHash"
  ...


Looks like FETCH has been invoked at that point and the script behaves
as intended.
Maybe gperl_get_object and gperl_get_object_check need

   SvGETMAGIC(sv);

*before* checking SvROK(sv)?

Cheers, Roderich



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