From: "druid" <[EMAIL PROTECTED]>
> this code will crash If I click the save button twice
> I must not be releasing some memory somewhere
>
dbPtr seems to be external. You're closing this database each time, but
keeping the dbPtr and trying to use it next time.
You need to be clearer about who owns dbPtr - if it's owned externally
then the db find, open and close should be external, if the open and
close are going to be done by this function then it needs to own the
dbPtr.
A fast fix is to set dbPtr to null after the close.
Chris Tutty
> static Boolean frmMain_saveButton_OnSelect(EventPtr event)
> {
(snip - no declaration of dbPtr)
> if(dbPtr == NULL)
> {
(snip of find, create and open db)
> }
> // Everything went smoothly:
>
(snip of create record and write data)
> err = DmCloseDatabase(dbPtr);
> return true;
> }
>
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/