Hi,
I'm new to perl/tk & also not an advance perl programmer,
I have read
many posts that windows + fork + perl/tk doesn't go well.
Here's my problem, I have a program written in perl and I'm preparing
a GUI for it.
I'm calling my existing program when I click a button on
my GUI. I'm redirecting the STDOUT to a
scrolled text widget using
this:
my existing program prints to STDOUT at different intervals but the
GUI freezes till my program returns,
as a result I'm forking a new
process which will call my program, Here's the code:
sub startButton_Click { tie *STDOUT, 'Tk::Text', $widget; unless ($pid = fork) { &Automation::Automate($testCase_text, $testSpec_text, $config_text); # my program untie *STDOUT; exit 0; } } waitpid($pid, 0);
The above works just as expected except, that it throws an error and
crashes,
just after the forked process finishes execution, this is the
error:-
Attempt to free non-existent shared string '_TK_RESULT_' at C:/Perl/ site/lib/Tk. pm line 247. panic: restartop
I tried replacing the 'unless ($pid = fork)' block with an async{ }
block (found this in some other forum),
but even then the same problem
occurs with this error:-
Attempt to free non-existent shared string '_TK_RESULT_' at C:/Perl/ site/lib/Tk. pm line 247. thread failed to start: _TK_EXIT_(0) Free to wrong pool 233ee8 not 31df658 during global destruction.
Please help!! am I doing something wrong here or can I completely avoid forking a new process
In reply to Please suggest a non-forking way to do this (OS: windows) by cranky
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |