diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2010-07-09 15:30:44 +0000 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2010-07-09 15:30:44 +0000 |
commit | c7e0f785c81676e70e4541817798999a420e0202 (patch) | |
tree | 46fb6300a966b8b5384aa77cc76cb95dec02f916 /Master/tlpkg | |
parent | 90d6f05755719766ccbcbe9eb8bea018f20ac348 (diff) |
Poperly destroy the main window when user closes it using her window manager.
(Avoids errors in the hooks due to $mw being neither valid nor undefined.)
git-svn-id: svn://tug.org/texlive/trunk@19304 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-rw-r--r-- | Master/tlpkg/installer/install-menu-perltk.pl | 8 | ||||
-rw-r--r-- | Master/tlpkg/installer/install-menu-wizard.pl | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl index 5ff59b27a47..7420160ad98 100644 --- a/Master/tlpkg/installer/install-menu-perltk.pl +++ b/Master/tlpkg/installer/install-menu-perltk.pl @@ -90,6 +90,11 @@ $::run_menu = \&run_menu_perltk; # ################################################################## +sub menu_abort { + $return = $MENU_ABORT; + $mainwindow->destroy; +} + sub setup_hooks_perltk { @::info_hook = (); push @::info_hook, @@ -134,6 +139,7 @@ sub update_progressbar { sub run_menu_perltk { calc_depends(); $mainwindow = Tk::MainWindow->new; + $mainwindow->protocol('WM_DELETE_WINDOW' => \&menu_abort); setup_hooks_perltk(); if (!win32()) { @@ -316,7 +322,7 @@ sub run_menu_perltk { )->pack(-side => 'left', -padx => "2m", -pady => "2m")->focus(); my $quitbutton = $f3->Button( -text => __("Quit"), - -command => sub { $return = $MENU_ABORT; $mainwindow->destroy } + -command => \&menu_abort, )->pack(-side => 'right', -padx => "2m", -pady => "2m"); $mw->bind('<Escape>', [ $quitbutton, 'Invoke' ]); #my $wizardbutton = $f3->Button( diff --git a/Master/tlpkg/installer/install-menu-wizard.pl b/Master/tlpkg/installer/install-menu-wizard.pl index 9be6c2697d4..b38e52a4897 100644 --- a/Master/tlpkg/installer/install-menu-wizard.pl +++ b/Master/tlpkg/installer/install-menu-wizard.pl @@ -92,6 +92,11 @@ $::run_menu = \&run_menu_wizard; # From here on only function definitions # #################################################################### +sub menu_abort { + $return = $MENU_ABORT; + $mw->destroy; +} + sub setup_hooks_wizard { @::info_hook = (); push @::info_hook, @@ -128,6 +133,7 @@ sub wizard_update_progressbar { sub run_menu_wizard { $mw = Tk::MainWindow->new(-width => $MWIDTH, -height => $MHEIGHT); + $mw->protocol('WM_DELETE_WINDOW' => \&menu_abort); setup_hooks_wizard(); $dest = $vars{'TEXDIR'}; @@ -156,7 +162,7 @@ sub run_menu_wizard { $can = $mw->Button(-width => 10, -relief => "ridge", -text => __('Cancel'), - -command => sub { $return = $MENU_ABORT; $mw->destroy; }); + -command => \&menu_abort); $prv = $mw->Button(-width => 10, -relief => "ridge", -text => __('< Back')); $nxt = $mw->Button(-width => 10, -relief => "ridge", -text => __('Next >')); |