ADC Home > Reference Library > Technical Q&As > Carbon > Process Management >

Process Carbon Events Not Delivered in 10.2


Q: I'm writing a Carbon application that tracks the list of running processes using the technique described in Technote 2050. Under Mac OS X 10.2 I'm not receiving any kEventAppLaunched, kEventAppFrontSwitched, or kEventAppTerminated events. Any ideas?

A: This is a bug in Mac OS X 10.2 (r. 2998556), which is an unfortunate side effect of another change (to initialize the Process Manager lazily, which allows programs that link with Carbon but do not use the high-level toolbox to run when no user is logged in). The simplest workaround is to force the initialization of the Process Manager before installing your Carbon event handlers. You can do this by making any Process Manager call before you call InstallApplicationEventHandler. Listing 1 shows the recommended way of doing this.



Listing 1. Initializing the Process Manager.

// Work around a bug (r. 2998556) in Mac OS X 10.2 by forcing
// the Process Manager to initialize itself.

{
    ProcessSerialNumber junkPSN;

    (void) GetCurrentProcess ( &junkPSN );
}

// Now call InstallApplicationEventHandler.


This bug will be fixed in a future release of Mac OS X, however there is no pressing need to remove or conditionalize this workaround because it is both simple and cheap.


[Jul 31 2002]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.