wulvrine has asked for the wisdom of the Perl Monks concerning the following question:
I have been having a problem converting a program that works on RedHat9 over to a Fedora (5,6,7) system. After the 3rd use of a font, I get a seg-fault. I have a small program that shows this exact problem
#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::Font; use Data::Dumper; printf "The version of Tk is '%s'\n", $Tk::VERSION; printf "The version of Tk::Font is '%s'\n", $Tk::Font::VERSION; make_gui(); MainLoop(); sub make_gui { # Main application window. my $mw = new MainWindow; # Create the font my @fontopts = (-family => 'Times', -size => 12, -weight => 'bold' +); my $font = $mw->fontCreate(@fontopts); my $psubfonts = $mw->font('subfonts', $font); print Data::Dumper->new([$mw->fontActual($font), $psubfonts], [qw()])->Indent(1)->Useqq(1)->Dump; my $phello = sub { print "Hello\n" }; my $fr = $mw->Frame()->pack(); print "Creating button 1...\n"; $fr->Button(-text=>"B1", -command=>$phello,-font=>$font)->pack(); print "Creating button 2...\n"; $fr->Button(-text=>"B2", -command=>$phello,-font=>$font)->pack(); print "Creating button 3...\n"; $fr->Button(-text=>"B3", -command=>$phello, -font=>$font)->pack(); }
When I run this, I get a seg fault while trying to create the third button.
Comment out the last $fr->Button command and a 2 button window is created.
If I remove all -font commands it works fine (keep adding more buttons etc).
(WIERDNESS: exiting out will cause a segmentation fault.. REMOVE fonts altogether and this fault also does not happen).
I searched here and on google, and I haven't found anything of help, so any assistance is appreciated.
Thanks!!
ps. code updated as per suggestion from zentara
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk fonts crash on Fedora
by Ray Smith (Beadle) on Nov 28, 2007 at 15:39 UTC | |
|
Re: Tk fonts crash on Fedora
by Tux (Canon) on Nov 28, 2007 at 16:02 UTC | |
|
Re: Tk fonts crash on Fedora
by zentara (Cardinal) on Nov 28, 2007 at 16:44 UTC | |
by wulvrine (Friar) on Nov 29, 2007 at 11:39 UTC | |
by zentara (Cardinal) on Nov 29, 2007 at 14:24 UTC | |
by wulvrine (Friar) on Nov 29, 2007 at 16:39 UTC | |
by zentara (Cardinal) on Nov 29, 2007 at 21:12 UTC | |
| |
|
Re: Tk fonts crash on Fedora
by shmem (Chancellor) on Nov 29, 2007 at 12:25 UTC | |
by wulvrine (Friar) on Nov 29, 2007 at 16:52 UTC | |
by shmem (Chancellor) on Nov 29, 2007 at 18:40 UTC | |
by wulvrine (Friar) on Nov 30, 2007 at 18:46 UTC | |
by shmem (Chancellor) on Nov 30, 2007 at 20:30 UTC | |
|
Re: Tk fonts crash on Fedora
by eserte (Deacon) on Nov 29, 2007 at 20:40 UTC | |
by wulvrine (Friar) on Nov 30, 2007 at 18:48 UTC | |
by eserte (Deacon) on Nov 30, 2007 at 20:41 UTC |