Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 83235
Status: open
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: ANDK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 804.030
Fixed in: (no value)



Subject: Perl v5.13.0-58-gefaf367 broke SREZIC/Tk-804.030.tar.gz
The attached program exposes the effect of the change referenced in the subject. Before the change the Label widget displayed the formatted running time just fine, but after the change it doesn't. Instead it displays random strings, often Unicode strings, but also often nothing at all. Here is the commit message of he change: commit efaf36747029c85b4d8825318cb4d485a0bb350e Author: David Mitchell <davem@iabyn.com> Date: Sun Apr 25 00:56:32 2010 +0100 add Perl_magic_methcall Add a new function that wraps the setup needed to call a magic method like FETCH (the existing S_magic_methcall function has been renamed S_magic_methcall1). There is one functional change, done mainly to allow for a single clean wrapper function, and that is that the method calls are no longer wrapped with SAVETMPS/FREETMPS. Previously only about half of them had this, so some relied on the caller to free, some didn't. At least we're consistent now. Doing it this way is necessary because otherwise magic_methcall() can't return an SV (eg for POP) because it'll be a temp and get freed by FREETMPS before it gets returned. So you'd have to copy everything, which would slow things down. HTH,
Subject: tkstopwatch.pl
use Tk; use Tk::ProgressBar; use strict; our $TV = "0.00"; my(%tinfo) = ( w => undef, s => 0, h => 0, p => 1, ); sub tick { return if $tinfo{p}; $tinfo{h} += 5; if ($tinfo{h} >= 100) { $tinfo{h} = 0; $tinfo{s}++; } $TV = sprintf("%d.%02d", $tinfo{s}, $tinfo{h}); $tinfo{w}->after(50, \&tick); } my $MW = MainWindow->new; $MW->bind('<Control-c>' => \&exit); $MW->bind('<Control-q>' => \&exit); $tinfo{w} = $MW; my $start = $MW->Button( -text => 'Start/Pause', -command => sub {$tinfo{p}^=1; tick}, ); my $counter = $MW->Label( -relief => 'raised', -width => 10, -textvariable => \$TV, ); $counter->pack(-side => 'bottom', -fill => 'both'); $start->pack(-side => 'bottom', -fill => 'both', -expand => 'yes'); my $pb = $MW->ProgressBar( -width => 200, -length => 800, -anchor => "w", -from => 0, -to => 800, -blocks => 800, -colors => [0, "green"], -variable => \$TV, )->pack; MainLoop;
Here's an even shorter example --- without Tk::ProgressBar, instead using a tied scalar. The label should show the string "changed", but some random string is shown instead. The problem is independent from perl, I could reproduce it with 5.8.9 and 5.16.1. use strict; use Tk; use Tie::Scalar; my $mw=tkinit; tie my $val, 'Tie::StdScalar'; $val = "init"; my $l = $mw->Label(-textvariable => \$val)->pack; $mw->afterIdle(sub { $val = "changed" }); MainLoop; The mentioned perl commit is probably not causing the problem, it's more likely that data is handled differently. Regards, Slaven
On 2013-02-09 12:12:56, SREZIC wrote: Show quoted text
> Here's an even shorter example --- without Tk::ProgressBar, instead > using a tied scalar. The label should show the string "changed", but > some random string is shown instead. The problem is independent from > perl, I could reproduce it with 5.8.9 and 5.16.1. > > use strict; > use Tk; > use Tie::Scalar; > my $mw=tkinit; > tie my $val, 'Tie::StdScalar'; > $val = "init"; > my $l = $mw->Label(-textvariable => \$val)->pack; > $mw->afterIdle(sub { $val = "changed" }); > MainLoop; > > The mentioned perl commit is probably not causing the problem, it's more > likely that data is handled differently. >
Update: on a debian/jessie system I could reproduce the problem with perls ranging from 5.8.8 to 5.18.4, but not anymore with 5.20.2 and later (Tk installed here: 804.032 .. 804.034, does not seem to matter).