Strange bug



This is from cvs HEAD (as of a few minutes ago). I've reduced the test case to the following. Working from perl-5.8.1. Problem is not linked to file format or whatever, substitute the gnome-icon with any kind of image file with the same results.

Error message is:
*** unhandled exception in callback:
***   variable is not of type Gtk2::Gdk::Drawable at t line 23.
***  ignoring at t line 31.

Something to do with ..._ornull typemap?

Bjarne
#/usr/bin/perl

use strict;
use Gtk2 -init;
use Data::Dumper;

my $window = Gtk2::Window->new ('toplevel');
$window->signal_connect (destroy => sub {Gtk2->main_quit;});

my $vbox = Gtk2::VBox->new (0, 0);
my $img = Gtk2::Image->new;
$vbox->pack_start ($img, 1, 1, 0);

my $but = Gtk2::Button->new_from_stock ('gtk-ok');
$but->signal_connect (clicked => sub {
    my $pbuf = Gtk2::Gdk::Pixbuf->new_from_file ('gnome-graphics.png');
    my ($pmap, $mask) = $pbuf->render_pixmap_and_mask_for_colormap (
        $img->window->get_colormap, 0
    );
    $mask = undef;
    $img->set_from_pixmap ($pmap, undef);
    # Why does the following fail, when the one above is OK?
    $img->set_from_pixmap ($pmap, $mask);
});

$vbox->pack_start ($but, 0, 0, 0);

$window->add ($vbox);
$window->show_all;

Gtk2->main;
exit 0;


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