68kMLA Classic Interface
This is a version of the 68kMLA forums for viewing on your favorite old mac. Visitors on modern platforms may prefer the main site.
| Click here to select a new forum. | | Patching _ExitToShell for application cleanup: any experience? | Posted by: cheesestraws on 2022-10-22 12:07:40 When talking about making sure you don't have any outstanding VBL tasks when a process exits, IMđrocesses helpfully suggests:
The easiest way to avoid this problem is to patch the Process Managerâs ExitToShell procedure so that it removes all VBL task records installed by your application.
I'm not sure about "easiest", but this procedure sounds both very useful and fraught with danger. Has anyone done it before? | Posted by: atax1a on 2022-10-23 14:48:39 coincidentally, we just read through the first issue of Develop which has opinions on just this topic:
Suppose, for example, you decide to patch ExitToShell. This may sound like an excellent way for your program to get one last chance at closing files or doing whatever other cleanup is necessary before exiting. Whether ExitToShell is called in response to a userâs Quit command or because of some fatal error condition, your patch would always have a chance to clean up. But rather than having ExitToShells all over your code, you could achieve the same result by calling a single, common exit routine that performed the cleanup and then called ExitToShell. Hope this helps đ | Posted by: cheesestraws on 2022-10-23 14:52:25
coincidentally, we just read through the first issue of Develop which has opinions on just this topic:
Thanks! It's amusing that IM and Develop give totally contradictory advice here... đ I think I'm just going to follow Develop's advice. It doesn't sound like a good idea. | Posted by: Crutch on 2022-10-23 20:28:33 I have actually tried this from an INIT and found that, at least in 7.5.5, it seems to be impossible to patch ExitToShell at INIT time because someone (the Process Manager?) installs a patch at some later time (before launching the Finder) that simply wipes out whatever was there. (This does not mean that you couldnât patch ExitToShell in the application heap, which I have not tried.) I recall the same being true of WaitNextEvent, incidentally.
FWIW though I donât think that develop article was saying there is anything particularly wrong with patching ExitToShell. Pretty sure it was just the usual âavoid patching generallyâ screed that was common from Apple, with ExitToShell a random example. (That issue of develop predates System 7, of course.) | | 1 |
|