Skip to content

Commit

Permalink
messageBox.t: alternative approach for X11
Browse files Browse the repository at this point in the history
Avoid using Perl exit() in after callback
See #14
  • Loading branch information
chrstphrchvz committed May 16, 2022
1 parent 3602d08 commit 2178ac9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions t/messageBox.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ my $top = MainWindow->new(-title => 'MessageBox Test');
$top->after(1000,
sub{
if( $top->windowingsystem eq 'x11' ){
ok(1);
exit(); # No using $top->destroy here, because we get grab error messages on X11
# But if we use this on windows, we get crashes.

# No using $top->destroy here, because we get grab error messages on X11
my $msgbox = $top->interp->widget(
'.__tk__messagebox', # implementation detail; see msgbox.tcl
'Tcl::pTk::Toplevel',
);
$msgbox->destroy;
}
else{
$top->destroy(); # This works without errors on windows
Expand Down

0 comments on commit 2178ac9

Please sign in to comment.