Danny Epstein <[EMAIL PROTECTED]> wrote:
> "Stephen Best" <[EMAIL PROTECTED]> wrote:
>> I'm getting a "DataMgr.c, Line:6915, Record isn't busy" message with OS
>> 4.0dr4 with the following code:
>>
>>    DmResizeRecord
>>    MemHandleLock
>>    DmWrite
>>    MemHandleUnlock
>>    DmReleaseRecord (dbR, index, true);
>>
>> I would have thought the DmReleaseRecord would be required here ...
> 
> I added this assert. You'll have to look a little further back in your code
> to find where you get the handle for the resource. Did you use
> DmQueryRecord, DmGetRecord, or DmNewRecord?

I'm a little confused.  It looks to me as if Stephen used *DmResizeRecord*
to get the handle.

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.

[Stephen]
> but don't I still need somehow to set the dirty bit?

DmResizeRecord doesn't set the dirty bit, but (unless newsize == oldsize)
it does change the contents of the record, so it seems as if it should.

So it seems like the correct way to use DmResizeRecord is to only use the
return value as a boolean indicating success, and when it's successful
always to use a DmGetRecord/DmReleaseRecord cycle to set the busy bit,
whether you want to write to it some more or not:

        if (DmResizeRecord != NULL) {
          DmGetRecord
          MemHandleLock    | These three lines needed only if you
          DmWrite          | actually want to write something to
          MemHandleUnlock  | the record
          DmReleaseRecord (..., true)
          }

    John  "but what do I know -- I mostly play with resource databases"

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to