[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
fetching unset GParamSpec property
- From: Kevin Ryde <user42 zip com au>
- To: gtk-perl-list gnome org
- Subject: fetching unset GParamSpec property
- Date: Tue, 24 Jun 2008 08:47:07 +1000
The program below gets some errors followed by a segv
GLib-GObject-CRITICAL **: g_param_spec_ref: assertion `G_IS_PARAM_SPEC (pspec)' failed at /home/gg/bug/default-value/param-null.pl line 19.
GLib-GObject-CRITICAL **: g_param_spec_sink: assertion `G_IS_PARAM_SPEC (pspec)' failed at /home/gg/bug/default-value/param-null.pl line 19.
GLib-GObject-CRITICAL **: g_param_spec_get_name: assertion `G_IS_PARAM_SPEC (pspec)' failed at /home/gg/bug/default-value/param-null.pl line 19.
I guess newSVGParamSpec() expect NULL. Is it meant to? Or is it up to
_gperl_sv_from_value_internal(), per below?
Maybe nobody ever used a paramspec property before. :-) I can't think
what it'd be for. An object factory object thing maybe.
--
"The only problem with Italian food is that 4 or 5 days later you start
feeling a bit peckish again."
package MyThing;
use strict;
use warnings;
use Glib;
use Glib::Object::Subclass
Glib::Object::,
properties => [ Glib::ParamSpec->param_spec ('myprop', 'myprop',
'Blurb.',
'Glib::Param::Boolean',
Glib::G_PARAM_READWRITE) ];
package main;
use strict;
use warnings;
use Data::Dumper;
my $obj = MyThing->new;
my $x = $obj->get ('myprop');
print Dumper($x);
exit 0;
--- GValue.xs 10 Jan 2008 09:50:05 +1100 1.22
+++ GValue.xs 23 Jun 2008 17:49:34 +1000
@@ -244,7 +244,16 @@
FALSE);
case G_TYPE_PARAM:
- return newSVGParamSpec (g_value_get_param (value));
+ /* can have NULL here fetching object properties of
+ type G_TYPE_PARAM with no value set yet, or from
+ ->get_default_value of such a property */
+ {
+ GParamSpec *ps = g_value_get_param (value);
+ if (ps == NULL)
+ return &PL_sv_undef;
+ else
+ return newSVGParamSpec (ps);
+ }
case G_TYPE_OBJECT:
return gperl_new_object (g_value_get_object (value), FALSE);
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]