Glib::Object::Subclass bug? or Misunderstanding?



Hello,

I recently upgraded the software on my machine and was very surprised to find that the behaviour of Glib::Object::Subclass has changed and breaks the code I've been working on. Lucky I found this before releasing it to the world! :-)

It seems that get() no longer works if I happen to have a SET_PROPERTY subroutine defined. Below is a small example that demonstrates the problem. If I comment out the SET_PROPERTY sub, I find that the tests pass, otherwise 2 of 3 fail. Is this a bug, or am I as usual missing something?

My setup: I'm running ZenWalk 2.2 which uses Linux kernel 2.6.15.4

My Gtk2-perl libs are: Glib-1.102, Gnome2-1.023, Gnome2-Canvas-1.002, Gnome2-Print-0.951, Gnome2-VFS-1.041, Gtk2-1.102.

use Test::More tests => 3;

use Gtk2 '-init';

use Gnome2::Canvas;

my $view = Gnome2::Canvas->new_aa();

my $goober = Gnome2::Canvas::Item->new($view->root, 'Goober', border=>99);

isa_ok( $goober, 'Goober');

my $border = $goober->get('border');

is( defined($border), 1, 'border should be defined');

is ($border, 99, 'border should have value 99');

exit 0;


package Goober;

use warnings;
use strict;

use Gnome2::Canvas;

use Glib ':constants';

use Glib::Object::Subclass
   Gnome2::Canvas::Group::,

   properties => [
Glib::ParamSpec->scalar ('border', 'border', 'The border', G_PARAM_READWRITE),
          ]
   ;


# Comment out the SET_PROPERTY and get() works!!
sub SET_PROPERTY
{
   my ($self, $pspec, $newval) = @_;

   my $param_name = $pspec->get_name;

   print "Item, SET_PROPERTY: name: $param_name value: $newval\n";
}







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