Re: Gtk2::TreeModel::foreach callback not getting any arguments?



On Wednesday, September 24, 2003, at 05:38 PM, Dan Lyke wrote:

muppet writes:
you can put any perl scalar, including blessed or unblessed references,
in a column of type Glib::Scalar.

So, completely silly question: Does this handle reference counting?
ie: If that's the only reference to a blessed object will that object
stay around, and if I delete the entry, will the object disappear?

yes.

if you look at line 510 of GType.xs (http://cvs.sourceforge.net/viewcvs.py/gtk2-perl/gtk2-perl-xs/Glib/ GType.xs?annotate=1.15), gperl_sv_copy() creates a new copy of the scalar with newSVsv. for references, the copy is the right thing to do, as it automagically increases the reference count of referred-to object. for normal scalars, you get a copy.

as expected, gperl_sv_free() uses SvREFCNT_dec() on the scalar.

--
muppet <scott at asofyet dot org>




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