"Philip Sheard" <[EMAIL PROTECTED]> wrote in message
news:40487@palm-dev-forum...
> > DmResizeRecord doesn't set the busy bit, so it seems like Stephen should
> > have subsequently used DmGetRecord to get a *writable* handle to the
> record.
>
> In other words, DmResizeRecord returns an utterly useless handle? And the
> (pre-4.0) documentation is wrong when it suggests that you use it?
No. If you already have a writable handle, and you subsequently resize the
record, you should use the returned handle rather than continuing to use the
original handle. For example:
h = DmGetRecord(...); // mark record busy before we modify/resize
it
...use h to modify the record if you want...
h = DmResizeRecord(...); // use new value for handle in case it moved
to a different heap
...use h to modify the record if you want...
DmReleaseRecord(..., true); // clear busy bit now that we're done
modifying/resizing - also set dirty bit
You can prefix the above with:
h = DmQueryRecord(...);
...use h to read the record to decide whether it needs to be
modified/resized...
if (...)
{
...the code above...
}
I don't think records will have to move between heaps on modern versions of
Palm OS. The memory manager was improved at some point a long time ago.
Before that, there were several storage heaps. Now there is only one. Still,
the rules for using DmResizeRecord require you to use the returned handle
rather than any previous handle you had for the record. It's a lot like the
way dynamic UI works. When you add a form object to a form, the form can
move, so pointers to form objects become invalid. Here the _handle_ can
become invalid. You don't really have to use the returned handle; you can
retrieve it again via DmGetRecord/DmQueryRecord.
--
Danny
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/