[comp.sys.mac.programmer] Wisdom of ExitToShell in a ShutDown proc

6600pete@ucsbuxa.ucsb.edu (03/03/90)

In the process of debugging a ShutDown proc, I have told the debugger
to 'es' (ExitToShell) a number of times. This has the curious but not
surprising effect of restarting MultiFinder and all her default
applications. Does anyone know if it would be a safe or wise practice
to allow a user to ExitToShell from a ShutDown proc?

(Questions about why I want to do this should be directed to mail;
obviously doing this is not congruent with any intuitive understanding
of The Interface; I may do it anyway.)
--

Pete Gontier   | InterNet: 6600pete@ucsbuxa.ucsb.edu, BitNet: 6600pete@ucsbuxa
Editor, Macker | Online Macintosh Programming Journal; mail for subscription
Hire this kid  | Mac, DOS, C, Pascal, asm, excellent communication skills

6600pete@ucsbuxa.ucsb.edu (GurgleKat [Pete Gontier]) (03/05/90)

From article <4143@hub.UUCP>, by 6600pete@ucsbuxa.ucsb.edu:
> In the process of debugging a ShutDown proc, I have told the debugger
> to 'es' (ExitToShell) a number of times. This has the curious but not
> surprising effect of restarting MultiFinder and all her default
> applications. Does anyone know if it would be a safe or wise practice
> to allow a user to ExitToShell from a ShutDown proc?

As I am told in mail, this has been hashed out on the net recently
(and I seem to in fact remember it vaguely...) and the answer was, finally,
no, it ain't wise to do this. The suggestion was to patch ShutDown. This
is why I vaguely remember the discussion. Someone said "Patch ShutDown?
When Apple's already provided ShutDown procs? Heresy!" And then someone
replied "Aw hell, go ahead and patch it. Apple already has."
--
Pete Gontier   | InterNet: 6600pete@ucsbuxa.ucsb.edu, BitNet: 6600pete@ucsbuxa
Editor, Macker | Online Macintosh Programming Journal; mail for subscription
Hire this kid  | Mac, DOS, C, Pascal, asm, excellent communication skills

leipold@eplrx7.uucp (Walt Leipold) (03/05/90)

In article <4143@hub.UUCP> 6600pete@ucsbuxa.ucsb.edu writes:
>In the process of debugging a ShutDown proc, I have told the debugger
>to 'es' (ExitToShell) a number of times. This has the curious but not
>surprising effect of restarting MultiFinder and all her default
>applications. Does anyone know if it would be a safe or wise practice
>to allow a user to ExitToShell from a ShutDown proc?

No, it's not safe to call ExitToShell from a ShutDown proc.  The thing to
do is patch _ShutDown.  In my case, I needed to execute my ShutDown task
only if the user had selected Shutdown (not Restart), but there wasn't any
way for my ShutDown routine to tell what kind of Shutdown was happening.
So I patched _ShutDown to save the top word of the stack (the routine
selector), and wrote a standard ShutDown proc which looked at the saved
routine selector to decide whether to do its thing.

Source code on request...

>Pete Gontier   | InterNet: 6600pete@ucsbuxa.ucsb.edu, BitNet: 6600pete@ucsbuxa
>Editor, Macker | Online Macintosh Programming Journal; mail for subscription
>Hire this kid  | Mac, DOS, C, Pascal, asm, excellent communication skills

-- 
"As long as you've lit one candle,                         Walt Leipold
you're allowed to curse the darkness."       (leipolw%esvax@dupont.com)
--
--
The UUCP Mailer