Re: Bug in pixbuf->copy ?
- From: Jaap Karssenberg <j g karssenberg student utwente nl>
- To: muppet <scott asofyet org>
- Cc: gtk-perl-list gnome org
- Subject: Re: Bug in pixbuf->copy ?
- Date: Tue, 18 Apr 2006 11:23:50 +0200
Hi Muppet,
The pixbuf thing appears to be have been a coding mistake on my side -
sorry to have wasted your time. A friend of mine spotted it and it seems
to me like a loophole in the "strict" pragma.
What I was doing was something like:
use strict; #!!!
sub insert_image {
my ($textbuffer, $file) = @_;
my $pixbuf = Gtk2::Pixbuf->new_from_file($file) if -f $file and -r _;
$pixbuf ||= Gtk2::Image->new->render_icon('gtk-missing-image',
'dialog')->copy;
# ...
}
Now the trouble was that my "missing image" icons all got to be the same
object.
What is happening is that $pixbuf although supposed to be locally scoped
variable becomes global in the case "-f $file and -r _" evaluates false.
Not sure if this works the same in other versions of perl - I'm
surprised that I didn't notice this behavior earlier in other programs.
Anyway, thanks for your time.
-- Jaap
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]