Hello fellow monks,

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

s&&VALKYRIE &&& print $_^q|!4 =+;' *|

In reply to Tk fonts crash on Fedora by wulvrine

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.