Skip navigation.
 
mlRe: What to do about sendQuitEventToApp to a daemon?
FROM : Tom Harrington
DATE : Thu Dec 16 20:22:01 2004

On Thu, 16 Dec 2004 09:27:00 -0600, Brian Bergstrand
<<email_removed>> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Don't link to the full Carbon Lib. Link only to CarbonCore, which is
> part of the CoreServices framework. This won't open a connection to the
> window server (which I think is the root of your problem).


I made the switch.  It was also necessary to link ApplicationServices,
though-- I forgot to mention that I had also called
GetProcessBundleLocation(), which seems to live in that framework.

Some further research indicates that the problem's not so much from
linking the wrong frameworks as from making the wrong calls.  I
replaced the code that needed CarbonCore and ApplicationServices with
an older version that required neither.  But I forgot to actually
un-check those frameworks in the project.  The result doesn't get the
sendQuitEventToApp on logout (and otool indicates that Mac OS X still
considers the frameworks linked, though I'm not using any code from
them anymore).

For what it's worth, the code that led to all this was a small
function that the command-line tool used to get its own absolute path,
which reads as follows:

char *getPathToSelf() {
   ProcessSerialNumber psn = {0, kCurrentProcess};
   FSRef processRef;
   UInt8 *path;
   GetProcessBundleLocation(&psn, &processRef);
   path = (UInt8 *)malloc(MAXPATHLEN * sizeof(UInt8));
   FSRefMakePath(&processRef, path, MAXPATHLEN);
   return path;
}

It works great, but if I use it, the daemon gets killed at logout.

--
Tom Harrington
<email_removed>

Related mailsAuthorDate
mlWhat to do about sendQuitEventToApp to a daemon? Tom Harrington Dec 16, 01:43
mlRe: What to do about sendQuitEventToApp to a daemon? Daniel Eggert Dec 16, 15:58
mlRe: What to do about sendQuitEventToApp to a daemon? Brian Bergstrand Dec 16, 16:27
mlRe: What to do about sendQuitEventToApp to a daemon? Tom Harrington Dec 16, 20:22
mlRe: What to do about sendQuitEventToApp to a daemon? Daniel Eggert Dec 17, 12:48