Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 43691
Status: resolved
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: slaven [...] rezic.de
veljko [...] 888.rs
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Tk exit problem on MacOs
Date: Fri, 27 Feb 2009 10:02:17 +0100
To: slaven [...] rezic.de, bug-Tk [...] rt.cpan.org
From: Veljko Popovic <veljko [...] 888.rs>
Hi, I'm implementing GUI using Tk on MacOS system. Problem is I can not catch expilicit X11 server shutdown via any known signal handler or WM message. Let me explain how to reproduce it if you have any mac by your side: start from terminal program I have sent you bellow command-Q on X11 instance in terminal you will receive X connection to $DISPLAY broken (explicit kill or server shutdown) and no handler will respond. I'm using latest version of TK from cpan Best regards and thanks in advance.... Veljko Popovic Software developer 888 d.o.o, Belgrade, Serbia P.S. I forgot to send you a program in my last mail :D #!/usr/bin/perl -w use strict; use Tk; my $mw=MainWindow->new; END { print "ending\n" } foreach my $s (keys(%SIG)) { #print "$s is about to be initialized\n"; $SIG{$s} = sub{print "signal $s intercepted\n";exit;} } $mw->OnDestroy(sub{print "On destroy responded\n";}); MainLoop;
CC: bug-Tk [...] rt.cpan.org
Subject: Re: Tk exit problem on MacOs
Date: Mon, 02 Mar 2009 21:17:59 +0100
To: Veljko Popovic <veljko [...] 888.rs>
From: Slaven Rezic <slaven [...] rezic.de>
Veljko Popovic <veljko@888.rs> writes: Show quoted text
> Hi, > > > I'm implementing GUI using Tk on MacOS system. Problem is I can not > catch expilicit X11 server shutdown via any known signal handler or WM > message. > Let me explain how to reproduce it if you have any mac by your side: > > start from terminal program I have sent you bellow > command-Q on X11 instance > in terminal you will receive X connection to $DISPLAY broken (explicit > kill or server shutdown) and no handler will respond. > > > I'm using latest version of TK from cpan >
Hello Veljko, I don't know what Mac's X server sends when it is about to shutdown, but I suspect it could do something with the WM_SAVE_YOURSELF protocol. See the manpage Tk::Wm, especially the ->protocol method for more information. Regards, Slaven -- Slaven Rezic - slaven <at> rezic <dot> de tktimex - time recording tool http://sourceforge.net/projects/ptktools/
On Fri Feb 27 04:03:00 2009, veljko@888.rs wrote: Show quoted text
> Hi, > > > I'm implementing GUI using Tk on MacOS system. Problem is I can not > catch expilicit X11 server shutdown via any known signal handler or WM > message. > Let me explain how to reproduce it if you have any mac by your side: > > start from terminal program I have sent you bellow > command-Q on X11 instance > in terminal you will receive X connection to $DISPLAY broken (explicit > kill or server shutdown) and no handler will respond. > > > I'm using latest version of TK from cpan > > Best regards and thanks in advance.... > > Veljko Popovic > Software developer > 888 d.o.o, Belgrade, Serbia > > > > P.S. > I forgot to send you a program in my last mail :D > > #!/usr/bin/perl -w > > use strict; > use Tk; > > my $mw=MainWindow->new; > > END { > print "ending\n" > } > foreach my $s (keys(%SIG)) > { > #print "$s is about to be initialized\n"; > $SIG{$s} = sub{print "signal $s intercepted\n";exit;} > } > $mw->OnDestroy(sub{print "On destroy responded\n";}); > MainLoop; >
There's faint hope that MacOSX's X server sends something via the X11 WM protocol before shutting the server down. Try to put $mw->protocol(WM_SAVE_YOURSELF => sub { warn "WM_SAVE_YOURSELF called" }); $mw->protocol(WM_DELETE_WINDOW => sub { warn "WM_DELETE_WINDOW called" }); in a test script and see if it is fired in some way. But there was no success experimenting on FreeBSD using this. So maybe the best is too create a wrapper process, and the Tk stuff is done in the child (see below for a sample). So you can easily detect if the script exits. You can also examine the value of $? after the wait() call to see if the script was killed or exited cleanly. Regards, Slaven #!/usr/bin/perl -w use Tk; if (fork == 0) { my $mw = MainWindow->new; # do something MainLoop; exit 0; } warn "Waiting for child...\n"; wait; warn "Child exited...\n"; __END__
Subject: Re: [rt.cpan.org #43691] Tk exit problem on MacOs
Date: Mon, 08 Feb 2010 13:32:57 +0100
To: bug-Tk [...] rt.cpan.org
From: Veljko Popovic <veljko [...] 888.rs>
won't do the job ... $mw->protocol(WM_SAVE_YOURSELF => sub { warn "WM_SAVE_YOURSELF called" }); $mw->protocol(WM_DELETE_WINDOW => sub { warn "WM_DELETE_WINDOW called" }); won't do the job on the MacOS ... Another process is cool for me ... Thank you for your time... Best regards.... Veljko S. Popovic Slaven_Rezic via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=43691 > > > On Fri Feb 27 04:03:00 2009, veljko@888.rs wrote: >
>> Hi, >> >> >> I'm implementing GUI using Tk on MacOS system. Problem is I can not >> catch expilicit X11 server shutdown via any known signal handler or WM >> message. >> Let me explain how to reproduce it if you have any mac by your side: >> >> start from terminal program I have sent you bellow >> command-Q on X11 instance >> in terminal you will receive X connection to $DISPLAY broken (explicit >> kill or server shutdown) and no handler will respond. >> >> >> I'm using latest version of TK from cpan >> >> Best regards and thanks in advance.... >> >> Veljko Popovic >> Software developer >> 888 d.o.o, Belgrade, Serbia >> >> >> >> P.S. >> I forgot to send you a program in my last mail :D >> >> #!/usr/bin/perl -w >> >> use strict; >> use Tk; >> >> my $mw=MainWindow->new; >> >> END { >> print "ending\n" >> } >> foreach my $s (keys(%SIG)) >> { >> #print "$s is about to be initialized\n"; >> $SIG{$s} = sub{print "signal $s intercepted\n";exit;} >> } >> $mw->OnDestroy(sub{print "On destroy responded\n";}); >> MainLoop; >> >>
> > There's faint hope that MacOSX's X server sends something via the X11 WM > protocol before shutting the server down. Try to put > > $mw->protocol(WM_SAVE_YOURSELF => sub { warn "WM_SAVE_YOURSELF called" }); > $mw->protocol(WM_DELETE_WINDOW => sub { warn "WM_DELETE_WINDOW called" }); > > in a test script and see if it is fired in some way. But there was no > success experimenting on FreeBSD using this. > > So maybe the best is too create a wrapper process, and the Tk stuff is > done in the child (see below for a sample). So you can easily detect if > the script exits. You can also examine the value of $? after the wait() > call to see if the script was killed or exited cleanly. > > Regards, > Slaven > > #!/usr/bin/perl -w > > use Tk; > if (fork == 0) { > my $mw = MainWindow->new; > # do something > MainLoop; > exit 0; > } > warn "Waiting for child...\n"; > wait; > warn "Child exited...\n"; > > __END__ > > >