trapping quit

Graham Samuel livfoss at blueyonder.co.uk
Thu Mar 20 09:52:01 EST 2003


I've been slightly out of circulation lately, but my scan thru all 
the recent digests didn't come up with any reply to the following:

On Mon, 17 Mar 2003 17:08:48 -0700, Devin Asay <devin_asay at byu.edu> wrote:
>
>I'm not getting something. I want to trap the quit message and do some
>stuff before my program quits. I finally settled on trying the
>shutdownRequest message. When I handle it and pass it in the
>development environment, it works as expected: it does the stuff I want
>it to do then quits Revolution. But when I compile the stack as a
>standalone, the shutdownRequest message gets executed, but the quit
>never happens. I even tried adding an explicit quit call to the
>shutdownRequest handler. The resultant standalone still will not quit.
>
>I read the dictionary entries for both shutdown and shutdownRequest.
>The latter seemed to be the one I wanted, but as I said, it's not
>working. The descriptions of both are a little sketchy, so maybe I'm
>not understanding something. Can someone shed some light on how these
>messages work and what is the best way to intercept then pass on a quit
>call. Jeanne?

Sadly, I can't answer the question, but can only add a supplementary: 
if the OS forces the app to quit, does an RR standalone get a 
'shutdownRequest' message? If so, it would prevent Mac apps from 
having to handle the 'quit' AppleEvent in order to shut down in good 
order, and it would prevent the ignorant of Windows and Unix (i.e. 
me) from having to understand what the drill is when an app is killed 
by the OS. I am willing to experiment, but I thought I would also see 
if anyone has any experience of this.

For me the issue is that in the Mac at least, a program is obliged to 
shut down in good order when called upon to do so, for example by 
avoiding insisting on user response (this is not the same as 
structuring a program to put itself back into good order when 
restarted after a crash, which is just good programming practice); 
not sure what the etiquette is for other OSs.

Hoping for enlightenment

Graham
-- 
-------------------------------------------------------------------
          Graham Samuel / The Living Fossil Co. / UK & France



More information about the use-livecode mailing list