LSSharedFileList API bug(s) -- workaround?
LSSharedFileList API bug(s) -- workaround?
- Subject: LSSharedFileList API bug(s) -- workaround?
- From: "Steven Degutis" <email@hidden>
- Date: Mon, 27 Oct 2008 15:24:50 -0500
I've been writing my own wrapper for the LSSharedFileList API to be able to
stick it in my Cocoa app. However I've found a few bugs.
One isn't that big of a deal, but I've filed a rdar for it anyway, and it's
that you can't actually set the Hide property. It just fails in odd ways.
The other one, however, is pretty major:
When you are running a 32/64-bit Universal binary on your Release target,
calling LSSharedFileListItemResolve() at all will trigger your callback.
If you have this being called inside your callback to determine if your own
application's path is one of the Login Items (for example to update an
NSMenuitem's state), this will trigger an infinite loop!
This has made my applications' real-memory usage go up over a GB, slowing my
Mac to a crawl, for no good reason!
Also, the seed value given by each update is unique, so unfortunately we
can't just ignore it if it matches the previous seed value.
One workaround I've tried is to
use LSSharedFileListRemoveObserver() *before*
using LSSharedFileListItemResolve(), and then afterwards, add myself back as
an observer. This completely fails to do anything useful. As another shot, I
tried to add self as an observer again in a method called after a certain
delay, for example 2.0 seconds. Again, it doesn't solve the issue. Then out
of desperation, I tried to CFRelease(sharedFileList) right after removing
myself as an observer, and then create it again
using LSSharedFileListCreate() right before
calling LSSharedFileListItemResolve(). This availed me nothing.
I've not filed a bug on this yet because I've been busy doing as much
testing as I can to find a better solution, lest I have to resort to using
the old, ugly ways of hacking this Login Item problem.
If anyone has any ideas for a workaround or solution, please let me know!
Steven Degutis
http://www.degutis.org/
http://www.thoughtfultree.com/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden