Hello,
The application i'm currently working on likes to crash when I switch to another
application. here's what's going on:
So long as I don't write anything to a database, the application is able to switch
without a problem. Once I write a record to the database, I can't switch the
application.
Here is the stopApplication( ) function:
******************************************************************************************************
static void StopApplication (void){
FrmSaveAllForms();
FrmCloseAllForms();
CloseDatabases();
}
******************************************************************************************************
whenever I write something to a database, the app stops immediately at FrmSaveAllForms
and FrmCloseAllForms(). The application has a lot of databases, so I open the relevant
databases when I go to a form, and close them when I leave the form.
I am not able to trace the application, it crashes straight to assembler (and I have
no experience with assembler of any kind). I have placed breakpoints in the handlers
for frmCloseEvent and frmSaveEvent with no avail. This leads me to believe I am not
doing something proper with the database, even though to the best of my knowledge I
am. here's the code where I write to the database:
******************************************************************************************************
//this is where the record packing and writing occurs
static void RecordPack(recordDBRecordPtr s, VoidPtr recordP){
ULong offset;
Int index;
UInt len;
VoidPtr srcP;
Err err;
customerPackedDBRecord* d=0;
offset=(ULong)&d->firstRecordField;
for (index=0; index < recordFieldsCount; index++){
srcP = s->fields[index];
len = StrLen(srcP) + 1;
err = DmWrite(recordP, offset, srcP, len);
offset += len;
}
}
//this is just a wrapper function, for all the usual reasons (readibilty, etc., etc.)
void setRecord(DmOpenRef dbRef, recordDBRecordPtr record, UInt index){
VoidHand recordH;
recordPackedDBRecord* dest;
recordH = DmGetRecord(dbRef, index);
dest = MemHandleLock(recordH);
RecordPack(record, dest);
MemHandleUnlock(recordH);
DmReleaseRecord(dbRef, index, true);
}
******************************************************************************************************
I don't believe this is the source of the problem because I can read and write to the
database w/o a problem.
Any insights?
-Jason
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/