Re: gperl_callback_invoke userdata copy
- From: Torsten Schoenfeld <kaffeetisch gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: gperl_callback_invoke userdata copy
- Date: Sat, 06 Sep 2008 14:36:28 +0200
Kevin Ryde wrote:
Do we want to support assigning to $_[-1]?
It could be in the docs if it's meant to work. I can't see any
disadvantage, it gets you a free bit of "state data" if you want to use
it that way.
I see GClosure for signals is this way -- refcnt inc and mortalize --
and assigning alters the stored data. I guess GPerlCallback can be the
same. The net change then to it is just a refcount fix which was
tickled by a callback disconnecting/destroying itself.
Yeah. Makes sense.
The patch looks good to me, except for this bit:
+ SvREFCNT_inc_simple_void_NN (data);
+ XPUSHs (sv_2mortal (data));
Why not this instead?
XPUSHs (sv_2mortal (SvREFCNT_inc (data)));
Or, if you really wanted to avoid the duplicate NULL check, SvREFCNT_inc_NN
instead of SvREFCNT_inc. But I don't think the win justifies using an obscure
] [Thread Prev