> From: Joe Siebenmann [mailto:[EMAIL PROTECTED]]
> I'm unclear on exactly when you need to do a MemHandleFree().
When you are completely finished using the memory chunk and will never need
to access it again. This API disposes of the chunk permanently.
> If I get a Handle from DmQueryRecord(), DmNewHandle()
> or DmGetRecord() I don't need to call MemHandleFree()??
> I AM calling MemHandleFree(), and I think that's where
> the "Free handle" error is from.
If you call MemHandleFree on a database record handle obtained by
DmQueryRecord or DmGetRecord, then you *destroy* the record! This is
probably not what you intend. Even worse, this corrupts the database itself
because the database still thinks the record handle refers to a valid memory
chunk, but it no longer does. MemHandleFree does *not* check to see if you
are accidentally trying to free a chunk that still belongs to a database.
If you do want to destroy a record, you can (1) detach it from the database
with DmDetachRecord and then free the memory yourself with MemHandleFree; or
(2) kill the record directly with DmDeleteRecord, DmRemoveRecord, or
DmArchiveRecord, as appropriate.
Or if you just want to "put away" the record until next time, call
DmReleaseRecord if you originally got it from DmGetRecord. Or if you used
DmQueryRecord you don't need to do anything.
(All these APIs are well documented but sometimes the "big picture" can be
hard to see at first.)
-slj-
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/