Subject: | Bug with Dialog/DialogBox |
Date: | Mon, 11 Nov 2013 21:07:39 +0000 |
To: | "bug-Tk [...] rt.cpan.org" <bug-Tk [...] rt.cpan.org> |
From: | Daniel Richards <Daniel.Richards [...] onsemi.com> |
Recently I was trying out Tk::TOTD, and came across a bug. Initially, I thought it was just their problem, but after they investigated it, it turns out to be a problem with the Dialog/DialogBox module.
The bug: Whenever I have a Dialog/DialogBox open and close the main window with the x button, the script does not close gracefully. In other words, control is not given back to the shell that called the script. This bug is reproducible in the code below. As I mentioned, it happens with either Dialog or DialogBox.
#!/usr/bin/env perl
use Tk;
use strict;
use warnings;
my $mw = MainWindow->new;
my $dialog = $mw->Dialog(-default_button => 'Yes', -buttons => [qw/Yes No Cancel/]);
$dialog->Show;
MainLoop;
Casey Kirsle, of Tk::TOTD, responded with this to say (along with the original bug report):
<URL: https://rt.cpan.org/Ticket/Display.html?id=90045 >
This seems to be a problem in Tk::DialogBox, which Tk::TOTD uses on the back-end.
I think the root problem is, again, that Tk::DialogBox uses waitVariable to determine when to close the dialog window, so when the dialog is open and you close the MainWindow behind its back, the variable it's waiting on is never updated, so the program doesn't exit. You might try opening a bug report for Tk::DialogBox to fix this underlying problem.
Casey also provided a workaround, also shown in the bug report.
Hopefully this will help you find the problem.
Daniel Richards
Intern
ON Semiconductor
Corp R&D Integration
Email: daniel.richards@onsemi.com
Work: 208-233-4690 x6316