Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PerlTk Thread

Status
Not open for further replies.

Kirsle

Programmer
Joined
Jan 21, 2006
Messages
1,179
Location
US
I'm writing an application in Perl/Tk and wanted to include a "Website" button, which when clicked, would open my website in their browser.

I'm using threads to create a separate thread to run the system command, so that the GUI won't freeze until the browser window is opened. Here's my code:

Code:
		$btnFrame->Button (
			-text             => 'Website',
			-background       => '#000000',
			-foreground       => '#EEEEEE',
			-activeforeground => '#00FFFF',
			-activebackground => '#000000',
			-command          => sub {
				&website();
			},
		)->pack (-padx => 10);

sub website {
	my $t = threads->new ( sub {
		system ("start [URL unfurl="true"]http://azulian.f2mb.com/");[/URL]
	});
	$t->detach;
}

What happens is, the explorer window pops up and goes to the website, all the while without freezing the GUI, but once the page finishes loading, the Perl interpreter gives one of those "Send error report" Windows XP errors. The console says this:

Code:
Attempt to free non-existent shared string '_TK_RESULT_', Perl interpreter: 0x1e
27adc at C:/usr/site/lib/Tk/Widget.pm line 98 during global destruction.
Free to wrong pool 1e26d00 not 232770 at C:/usr/site/lib/Tk/Widget.pm line 98 du
ring global destruction.

Does Tk try to share widgets between threads automatically, or am I doing something wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top