I have a piece of code that copies some text to a buffer, then makes a memo
from the buffer.
This has worked in my product on every OS 5 device except the T3. On the
T3, I get the following error when calling
DmCloseDatabase(memoDB);
DataMgr.c, Line:7399, DmWrite: DmWriteCheck failed
Notice that it says DmWrite is writing this fatal alert. This is happening
when I call DmCloseDatabase. Looking at the DataMgr.c source, I cannot see
where DmCloseDatabase even calls DmWrite. Anyhow does anyone see anything
wrong with the code I have below that would cause the above to happen only
on the T3(and T3 simulator), and it happens when DmCloseDatabase is called.
Thanks,
Scott
DmOpenRef memoDB;
MemHandle hNew;
char *writebuf;
UInt16 numbytes;
UInt16 RecNum;
Char *theMemo;
Err err;
UInt32 tlong;
DateTimeType td;
#define MemoBufsize 1024
Char buf[40];
memoDB = DmOpenDatabaseByTypeCreator( 'DATA', 'memo',
dmModeReadWrite);
if (!memoDB) {
break;
}
writebuf = (char *) MemPtrNew(MemoBufsize);
if (!writebuf) {
FrmAlert(NoMemAlert);
DmCloseDatabase(memoDB);
break;
}
numbytes = 0;
// copy some stuff to the writebuf
hNew = DmNewRecord(memoDB, &RecNum, MemoBufsize);
if (!hNew) {
FrmAlert(NoMemAlert);
DmCloseDatabase(memoDB);
break;
}
theMemo = MemHandleLock(hNew);
DmStrCopy(theMemo, 0, writebuf);
err = MemHandleResize(hNew, numbytes);
MemHandleUnlock(hNew);
DmReleaseRecord(memoDB, RecNum, true);
err = DmCloseDatabase(memoDB);
MemPtrFree(writebuf);
}
break;
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/