notify and container add closures

The 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/ line 30.
***  ignoring at /tmp/ line 42.
_do_add() ends()

package Foo;
use 5.008;
use strict;
use warnings;
use Gtk2;
use Data::Dumper;

use Glib::Object::Subclass
  signals => { add => \&_do_add,
               notify => \&_do_notify,
  properties => [ Glib::ParamSpec->int

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],

  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";
  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]