notify and container add closures
- From: Kevin Ryde <user42 zip com au>
- To: gtk-perl-list gnome org
- Subject: notify and container add closures
- Date: Fri, 27 Jan 2012 08:51:31 +1100
The foo.pl below has trouble in a notify closure reached from a
container add closure.
The notify closure prints its invocation_hint and the second one
suggests glib thinks it's still in signal "add", not signal "notify", so
the marshalling for signal_chain_from_overridden() gets an arg type
mismatch. Is there any good reason for this?
This is a cut-down ToolItem subclass (a slightly strange subclass) I'd
been using and it had seemed fine until maybe glib 2.28, but now is no
good in 2.30.2.
I suppose I'd have to write it up in C to be sure whether glib or the
perl bindings are to blame. Is the concept of a notify from an add
sound enough though?
In my real code the notify is because I made a property which exposes
the child widget in another way, so after an add the property should be
reported as changed.
Perl-Gtk2 version 1.242
Gtk2 version 2.24.8
Glib version 2.30.2
_do_notify() begins
$invocation_hint = {
'detail' => 'double-buffered',
'signal_name' => 'notify',
'run_type' => bless( do{\(my $o = 1)}, 'Glib::SignalFlags' )
};
_do_notify(), chain up
_do_notify(), chain returned
_do_add(), chain up
_do_add(), chain returned()
_do_add(), call notify()
_do_notify() begins
$invocation_hint = {
'detail' => undef,
'signal_name' => 'add',
'run_type' => bless( do{\(my $o = 1)}, 'Glib::SignalFlags' )
};
_do_notify(), chain up
*** unhandled exception in callback:
*** Glib::Param::Int=HASH(0x990ae08) is not of type Gtk2::Widget at /tmp/foo.pl line 30.
*** ignoring at /tmp/foo.pl line 42.
_do_add() ends()
package Foo;
use 5.008;
use strict;
use warnings;
use Gtk2;
use Data::Dumper;
use Glib::Object::Subclass
'Gtk2::ToolItem',
signals => { add => \&_do_add,
notify => \&_do_notify,
},
properties => [ Glib::ParamSpec->int
('foo',
'foo',
'Blurb.',
0,100,0,
Glib::G_PARAM_READWRITE),
];
sub _do_notify {
my ($self, $pspec) = @_;
print "_do_notify() begins\n";
my $invocation_hint = $self->signal_get_invocation_hint;
print Data::Dumper->Indent(1)->Dump([$invocation_hint],
['invocation_hint']);
print "_do_notify(), chain up\n";
$self->signal_chain_from_overridden ($pspec);
print "_do_notify(), chain returned\n";
}
sub _do_add {
my ($self, $child) = @_;
print "_do_add(), chain up\n";
$self->signal_chain_from_overridden ($child);
print "_do_add(), chain returned()\n";
print "_do_add(), call notify()\n";
$self->notify('foo');
print "_do_add() ends()\n";
}
package main;
use Gtk2 '-init';
print "Perl-Gtk2 version ",Gtk2->VERSION,"\n";
print "Gtk2 version ",Gtk2::major_version(),".",Gtk2::minor_version(),".",Gtk2::micro_version(),"\n";
print "Glib version ",Glib::major_version(),".",Glib::minor_version(),".",Glib::micro_version(),"\n";
print "\n";
my $child_widget = Gtk2::Button->new ('XYZ');
my $toolitem = Foo->new;
$toolitem->add ($child_widget);
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]