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
In reply to Tk fonts crash on Fedora by wulvrine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |