Re: need help with CFMessagePortCreateRunLoopSource crash
Re: need help with CFMessagePortCreateRunLoopSource crash
- Subject: Re: need help with CFMessagePortCreateRunLoopSource crash
- From: John Timmer <email@hidden>
- Date: Tue, 11 Mar 2003 16:20:44 -0500
Hi Frank -
As far as I can tell, anything connected to the WindowServer will be
terminated during logout. In fact, as of 10.2.4, you can't even launch a
GUI-based app when nobody's logged in (you used to be able to ssh in and use
"open" to launch things, but now you get a bus error).
Is there any way to split your notification into a separate process from the
daemon? IE - you can have the daemon launched during startup and never
connect to the WindowServer (so it stays live), but use it to launch a
separate notification app whenever someone is logged in.
As for detecting login status, the following works for me:
- (bool)nobodyLoggedIn {
// Apple's got example code showing that this function will return null
// if nobody's logged in at the moment
CFStringRef userName;
userName = SCDynamicStoreCopyConsoleUser(NULL, NULL, NULL);
if (userName == NULL) {
return YES;
} else {
CFRelease(userName);
// somebody's logged in, so clear this value
haveLaunchedShellScripts = NO;
return NO;
}
}
You can call this in a loop with a sleep() statement in it, or you can call
it from a method that's triggered by an NSTimer. I've played around with
this sort of thing a lot, so if you want to discuss what's (apparently)
possible, please feel free to email me directly.
Cheers,
John
>
Hi all,
>
>
I need help again, I simply don't get it :)
>
>
I had a daemon started during boot time and it run fine. Then I wanted
>
to display
>
a status item, and with help from some readers here, I've learned that
>
I must
>
connect to the WindowServer so I called NSApp = [NSApplication
>
sharedApplication];
>
/ [NSApp run]; and was able to display a NSStatusItem, fine.
>
>
Now when a user logs out, my process gets terminated (is there a way to
>
get
>
notified about logout?) It seems that NSApplicationShouldTerminate or
>
NSApllicationWillTerminate
>
are not called at all?!
>
>
So I wrote a little launch helper that relaunches the daemon process in
>
case it
>
terminates but this results in crashes in
>
CFMessagePortCreateRunLoopSource
>
when [NSApp sharedApplication] is called.
>
>
What can I do about this? How safely restart my daemon and still use my
>
status item?
>
Or is there even a way to prevent the process being terminated during
>
logout, even
>
if the NSStatusitem is still displayed?
>
>
And yes, I tried to find a solution in the message archive of this list
>
but with no real luck :)
>
>
--
>
>
regards
>
Frank Fenn - Bright Light Software
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.