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: Sun, 31 Aug 2008 16:47:28 +0200
Kevin Ryde wrote:
It's safer and more correct to use the copy,
Does it also work to SvREFCNT_inc and sv_mortal, instead of a copy as
such? I guess the difference is then assigning to $_[-1] would modify
the stored userdata for subsequent calls, would it? (Maybe a good
thing, maybe a very bad thing! :-).
I don't know if it will work -- did you try it?
Prior to changing gperl_callback_invoke to use sv_mortalcopy, we just pushed the
user data SV as is on the stack, so that assigning to $_[-1] would change the
original SV, I think. With sv_mortalcopy, this changed. So, if we want to
support assigning to $_[-1], then sv_mortalcopy should indeed be ditched in
favor of something that just adjusts reference counts.
Do we want to support assigning to $_[-1]?
(Note that passing variables by reference and modifying them inside the callback
still works. sv_mortalcopy does a "shallow" copy.)
--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]