GNOME Bugzilla – Bug 567653
signal_chain_from_overridden vs do_mysig
Last modified: 2009-03-01 23:40:05 UTC
In perl-Glib 1.200 The program below gets two errors GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed at foo.pl line 36. *** unhandled exception in callback: *** [gperl_value_from_sv] FIXME: unhandled type - 0 ((null) fundamental for (null)) *** ignoring at foo.pl line 44. I expect it's the "do_" default handler of gperl_signal_class_closure_marshal, but g_signal_chain_from_overridden in GSignal.xs might like to consider passing return_value==NULL (instead of a GValue of G_TYPE_NONE) when the signal return type is none (query.return_type == G_TYPE_NONE). package MyClass; use strict; use warnings; use Glib; use Glib::Object::Subclass 'Glib::Object', signals => { mysig => { param_types => [], return_type => undef }, }; sub INIT_INSTANCE { my ($self) = @_; } sub do_mysig { print "MyClass mysig runs\n"; return 123; } package MySubClass; use strict; use warnings; use Glib::Object::Subclass 'MyClass', signals => { mysig => \&_do_mysubclass_mysig }; sub INIT_INSTANCE { my ($self) = @_; } sub _do_mysubclass_mysig { my ($self) = @_; $self->signal_chain_from_overridden; } package main; use strict; use warnings; my $obj = MySubClass->new; $obj->signal_emit ('mysig'); exit 0;
This is now fixed in trunk (r1078:1080) and in the stable branch (r1081).
Actually the point of this ticket was the latter part, ie. that the signal_chain_from_overridden() method might pass return_value==NULL to g_signal_chain_from_overridden() when the signal return type is G_TYPE_NONE. Doing so would be like a normal emission, per g_signal_emit_valist() lines if (signal_return_type == G_TYPE_NONE) signal_emit_unlocked_R (node, detail, instance, NULL, instance_and_params);
Sorry, I missed that part. I'm not sure what implications this change would have. Do you have an example where the change has an effect?
Umm, no. I was hoping the gsignal docs might say if G_TYPE_NONE is meant to be ok. I suppose if GtkBindings does that then it can't be too terrible. "When the president does it it's not illegal."