At 06:40 PM 8/4/2002 -0700, you wrote:
>The code below fires when I click on a  list that is displayed via a pop 
>up trigger.  If I click on the trigger and select an
>item in the list, on the 14th time I get a chunk overlocked error.  (See 
>line in question).  I am using DmReleaseRecord paired
>with the DmGetRecord and the MemHandleUnlock with the MemHandleLock.  What 
>am I missing.
>
>h = DmGetRecord(gClientProfileDB, index);
>
>   if (h) { // could fail due to out of memory!
>    skelClientProfileDBType* s = (skelClientProfileDBType*) 
> MemHandleLock(h);  // line in question
>
>    // Set the variables to populate the textboxes
>    txtDate = s->Date;
>    StrIToA(gAge, s->Age);
>    txtClient = s->PUN;
>
>    MemHandleUnlock(h);
>   }
>   DmReleaseRecord(gClientProfileDB, index, true);

Looks OK to me. I would put the DmReleaseRecord inside the 'if' so it only 
gets executed if the DmGetRecord succeeds (not sure if this requires any 
memory to succeed). You may also want to use DmQueryRecord (which doesn't 
require a release) as you are not writing to the record. Also, txtDate and 
txtClient will be invalid if they point into the record, the moment you 
unlock the handle.

You must be locking handle elsewhere.

Matt


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

Reply via email to