more fixes for DISOWN
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7719 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7af6ee8267
commit
651046b927
2 changed files with 12 additions and 13 deletions
|
|
@ -148,18 +148,17 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *
|
|||
almost copy paste code from bellow SWIG_POINTER_OWN setting
|
||||
*/
|
||||
SV *obj = sv;
|
||||
HV *hv;
|
||||
HV *stash;
|
||||
stash=SvSTASH(SvRV(obj));
|
||||
GV *gv= *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
|
||||
if (!isGV(gv))
|
||||
gv_init(gv, stash, "OWNER", 5, FALSE);
|
||||
hv = GvHVn(gv);
|
||||
/*
|
||||
To set ownership (see bellow), we use newSViv(1). Hence, to
|
||||
remove ownership, now we use newSViv(0), right?
|
||||
*/
|
||||
hv_store_ent(hv, obj, newSViv(0), 0);
|
||||
HV *stash = SvSTASH(SvRV(obj));
|
||||
GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
|
||||
if (isGV(gv)) {
|
||||
HV *hv = GvHVn(gv);
|
||||
/*
|
||||
To set ownership (see bellow), an newSViv(1) entry is added.
|
||||
Hence, to remove ownership, we delete the entry.
|
||||
*/
|
||||
SV *v = hv_delete_ent(hv, obj, 0, 0);
|
||||
if (v) SvREFCNT_dec(v);
|
||||
}
|
||||
}
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue