ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-tk
perl-tk
Segmentation faults with Perl/Tk
by Amit Didwania other posts by this author
Aug 2 2007 2:58AM messages near this date
| use Tk & use Hash::NoVivify
SOURCE Hello All,

This problem has been discussed in past.  I could see it in the bulletin
board of Perl Tk
http://groups.google.com/group/comp.lang.perl.tk/browse_thread/thread/35
58a8fd6a058721/9476da23af60b648?#9476da23af60b648

I took the examples from one of these discussions, made slight
modification. Sample script is given at the bottom of the mail
All test are on same platform : 5.8 Generic_117350-46 sun4u sparc
SUNW,Sun-Fire-V440

*	Perl Version : v5.8.8
Tk Version : 804.0275
You would have click OK on the button some number of times. I was able
to reproduce the problem 100% of the time.
I removed MainLoop from sub button1 then the code crashed much faster. I
cannot generalize this statement, but this was my observation.

*	I also tried with 
Perl Version : v5.8.7
Tk version : 804.027
This crashes as well

*	Perl Version : v5.8.5
Tk version : 804.027
This crashes as well

*	Perl Version   : v5.8.4
Tk Version : 804.027
This crashes as well

*	Perl Version : v5.6.1
Tk Version : 800.023
Tried five six times up to 200 clicks, no problems at all. Does Not
crash

*	Perl Version : 5.005_03
Tk Version :800.015
Tried five six times up to 200 clicks no problems at all. Does Not crash

Thanks and Regards
Amit



############Sample Script###############
use Tk;
my $var = 0;
$w1 = new MainWindow;
$w1-> Label(-text=>"Click Button1, then click the Button2 which 
appears.\nRepeat this two or three times.")-> pack;
$w1-> Entry(-textvariable => \$var )->pack;
$w1-> Button(-text=>'Button1',-command=>\&button1)->pack;
MainLoop;

sub button1
{
$w2 = new MainWindow; 
$w2-> Label(-text=>"When you click Button2, \nthis window will be
destroyed \nand a Checkbutton will be created in the first
window.")-> pack;
$w2-> Button(-text=>'Button2',-command=>\&button2)->pack; 
MainLoop;
}

sub button2
{
$w2-> destroy;
#^^^^^^^  This destroy is the key to the core dump.
# If this destroy is at the end of this function, all is well.
#$f1-> Checkbutton(-text=>"Check")->pack; 
$var++;
}

--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
ptk@[...].edu
https://mailman.stanford.edu/mailman/listinfo/ptk

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved