If anyone cares, its another bug in NVFS - confirmed by paying for an incident.
Call the following function in a loop 200+ times and it will crash every time.
If anyone wants the full project, email me and I'll send it.
-Dave
void UserLogAdd (char* text)
{
Err err = 0;
MemHandle recH;
UserLogPtr userlog;
UInt16 pos;
MemPtr recP = NULL;
// Keep at most 200 log entries
while (DmNumRecords(UserLogDB) > 200)
DmRemoveRecord(UserLogDB, 200);
userlog = (UserLogPtr)MemPtrNew(sizeof(UserLogType));
userlog->time = TimGetSeconds();
userlog->emp_id = 2;
StrCopy (userlog->text, text);
pos = 0;
recH = DmNewRecord (UserLogDB, &pos, sizeof(UserLogType));
if (!recH)
return;
recP = MemHandleLock(recH);
DmWrite (recP, 0, userlog, sizeof(UserLogType));
MemPtrFree (userlog);
MemHandleUnlock(recH);
DmReleaseRecord(UserLogDB, pos, true);
err = DmSyncDatabase(UserLogDB);
if (err)
ErrAlert (err);
}
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/