At 11:30 AM 6/11/2004, you wrote:
I implemented the feature memory, and I'm storing my settings in application preferences. However, I wanted to check that I'm doing it correctly, as my device is resetting itself on me, which seems to suggest I'm doing some memory operations incorrectly. And I haven't quite figured out the source of the problem.

//The first time I need the preferences I do:
if(FtrGet(appFileCreator, 1, (UInt32 *)&prefs) != 0)
{
FtrPtrNew(appFileCreator, 1, 32, &newPrefs);
PrefGetAppPreferences(appFileCreator, (UInt16)0, &prefs, &prefsSize, true);
DmWrite(newPrefs, 0, &prefs, prefsSize);
}


//When I'm done
  PrefSetAppPreferences(appFileCreator, 0, 1, &prefs, sizeof(prefs), true);

Is that correct? Do I need to add a Dmwrite after that to save it?

You've verified that 32 bytes is sufficient to store your prefs structure in memory, right?


Where is "prefs"? Is this a stack object, a MemPtrNew'd buffer, or something else?

You don't need a DmWrite after the PrefSetAppPreferences, but I'd be concerned that you could have those two structures get out of sync.



-- 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