Discussion:
Perl/TK Tk_Freecursor-Error
(too old to reply)
pit
2015-08-20 12:04:58 UTC
Permalink
Hi All,

I have the following problem with programs in perl/tk under Windows 8.1 with perl 5.14 and TK version 804.032

In the program exists an HList. When I scroll down the list and then finish the program, comes the following message:

"Tk_FreeCursor received unknown cursor argument"

and the program doesn't finish correctly.

Can someone help me ?

Pit
$Bill
2015-08-20 21:02:30 UTC
Permalink
Post by pit
Hi All,
I have the following problem with programs in perl/tk under Windows 8.1 with perl 5.14 and TK version 804.032
"Tk_FreeCursor received unknown cursor argument"
and the program doesn't finish correctly.
Can someone help me ?
Remove as much code as you can where it still reproduces the error. This
will either give you an idea of where the fault is or you can post the
small remaining snippet for others to peruse/try.
pit
2015-08-24 10:16:51 UTC
Permalink
Post by $Bill
Post by pit
Hi All,
I have the following problem with programs in perl/tk under Windows 8.1 with perl 5.14 and TK version 804.032
"Tk_FreeCursor received unknown cursor argument"
and the program doesn't finish correctly.
Can someone help me ?
Remove as much code as you can where it still reproduces the error. This
will either give you an idea of where the fault is or you can post the
small remaining snippet for others to peruse/try.
here is my the code snippet:

use strict;
use Tk;
use Tk::HList;

my $mw = MainWindow->new(-title => 'Mainwindow',
-cursor => 'arrow');
$mw->protocol("WM_DELETE_WINDOW", \&del_win);

my $cursor = $mw->cget(-cursor);

my $hl = $mw->Scrolled('HList',
-columns => 1,
)->pack(-expand => 1,
-fill => 'both',
-side => "top",
-anchor => "nw");

my $i;
for ($i = 0; $i <= 20; $i++)
{
$hl->add($i);
$hl->itemCreate($i, 0, -text => $i);
}

$hl->update();

MainLoop;

sub del_win
{
$mw->destroy();
Tk::exit(1);
}

Start the program, scroll down some lines and finish the program, then the error will be occured. When scrolling down and scroll up again to the first line, it doesn't happen.

pit
$Bill
2015-08-24 18:28:00 UTC
Permalink
Post by pit
Post by pit
Hi All,
I have the following problem with programs in perl/tk under Windows 8.1 with perl 5.14 and TK version 804.032
"Tk_FreeCursor received unknown cursor argument"
and the program doesn't finish correctly.
...
Post by pit
Start the program, scroll down some lines and finish the program, then the error will be occured. When scrolling down and scroll up again to the first line, it doesn't happen.
I can't reproduce it, so that leads me to believe it's a version/platform issue.
I'm on Doze 8.1 with AS Perl 5.20 and Tk 804.033

See if this one does the same (removed the delete window parts).

use strict;
use warnings;
use Tk;
use Tk::HList;

my $mw = MainWindow->new(-title => 'Mainwindow', -cursor => 'arrow');
my $cursor = $mw->cget(-cursor);
my $hl = $mw->Scrolled('HList', -columns => 1,)->pack(
-expand => 1, -fill => 'both', -side => "top", -anchor => "nw");
$mw->Button(-text => 'Quit', -command => sub { exit; })->pack(
-side => 'bottom');
for (my $i = 0; $i <= 20; $i++) {
$hl->add($i);
$hl->itemCreate($i, 0, -text => $i);
}
$hl->update();

MainLoop;
Roger Bell_West
2015-08-24 18:33:38 UTC
Permalink
Post by $Bill
See if this one does the same (removed the delete window parts).
No error for me, Linux perl 5.14.2 and Perl/Tk 1:804.030-1.
Roger Bell_West
2015-08-24 18:32:21 UTC
Permalink
Post by pit
Start the program, scroll down some lines and finish the program, then the error will be occured. When scrolling down and scroll up again to the first line, it doesn't happen.
Unable to reproduce on Perl 5.14.2, Perl/Tk 1:804.030-1. Program exits
normally.
n***@gmail.com
2019-02-17 04:50:41 UTC
Permalink
Post by pit
Hi All,
I have the following problem with programs in perl/tk under Windows 8.1 with perl 5.14 and TK version 804.032
"Tk_FreeCursor received unknown cursor argument"
and the program doesn't finish correctly.
Can someone help me ?
Pit
3 years later I found this issue to still be occurring on 64-bit builds of Perl. It seems that a type Tk_Cursor was added to replace Cursor and not all files were updated with the new type. On 32-bit builds there is no difference between the two but on 64-bit builds Tk_Cursor is a 64-bit value and Cursor is a 32-bit value which leads to errors when dereferencing Tk_Cursor pointers that are actually backed by 32-bit Cursor data types.

I created a PR that resolves the issue but Perl::Tk doesn't seem to be maintained anymore. https://github.com/eserte/perl-tk/pull/40
Loading...