At 04:17 AM 6/20/2004, Jan Slodicka wrote:
Probable explanation is this:
The user deleted a registered application incorrectly so that its
registration was not removed. At least this follows from the published Palm
OS sources (they seem to have a bug leaving the prefs database opened).
Additionally, we managed to "construct" such a situation in the described
way.

Your analysis is correct. I can add a little more information to this:

The problem is that there's code in Palm OS that isn't cleaning up properly after an error. Specifically, the exchange manager uses entries in the "Unsaved Preferences" database to store information about what kinds of objects your application has registered for. On Palm OS 5 and earlier, these entries have IDs 0xFFFB (-5) through 0xFFFE (-2) -- here's the text from ExgMgr.h that identifies these registries:

#define exgRegCreatorID    0xfffb // creator ID registry
#define exgRegSchemeID     0xfffc // URL scheme registry
#define exgRegExtensionID  0xfffd // filename extension registry
#define exgRegTypeID       0xfffe // MIME type registry

Well, if a user runs an application that registers itself from an expansion card, these entries don't get deleted when the application ends, since the general rule is to allow unassociated prefs entries for card-based apps.

OK, so Exchange Manager is looking for an entry, and it iterates through all of these records. When it hits one that doesn't actually have an on-device application, it returns an error. However, some of the calls that do this don't clean up the data structure associated with the search, and that leaves the Prefs DB open; on the next call to a function that uses the prefs DB, the system crashes with the "pref DB open error".

I'm working on a little fix program that will clear out all of the ExgMgr unsaved prefs entries for apps that aren't on the device; this won't prevent it from reoccurring, but it can fix a device where this is already happening. You can also do this manually using RsrcEdit or some other prefs editor.


-- Ben Combee, DTS technical lead, PalmSource, Inc. Read "Combee on Palm OS" at http://palmos.combee.net/



--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to