[EMAIL PROTECTED] wrote:

> (I tried posting this yesterday and it hasn't appeared yet. Sorry if 
> this ends up as a duplicate.)
> Is there anything a component needs to do to become a service? Just 
> having the clients call the service manager seems to work.


It does work.  There is a bit in the nsIClassInfo interface that 
indicates "this component is a singleton" but AFAIK this is not used 
yet, and is provided for the future.


> Is there a way to notify a component that mozilla is about to shut down? 
> I assume that putting code like file IO that may depend on other XPCOM 
> services in the destructor is not a real good idea.


Adding a listener to the nsIObserver interface for "xpcom-shutdown" (or 
from C++, NS_XPCOM_SHUTDOWN_OBSERVER_ID) should do the job.

http://lxr.mozilla.org/seamonkey/search?string=xpcom-shutdown and/or 
http://lxr.mozilla.org/seamonkey/search?string=NS_XPCOM_SHUTDOWN_OBSERVER_ID 
should give you far more examples than you need :)

Mark.


Reply via email to