>Is it very unsafe to access myPtr after this FOR loop?
Yes, very much so. The whole point of MemHandleLock is to assure the
validity of the pointer it returns. Calling MemHandleUnlock invalidates
the pointer MemHandleLock returns.
-- Keith
Philip Ho <[EMAIL PROTECTED]> on 06/09/99 01:11:08 AM
Please respond to [EMAIL PROTECTED]
Sent by: Philip Ho <[EMAIL PROTECTED]>
To: Palm Developer <[EMAIL PROTECTED]>
cc: (Keith Rollin/HQ/3Com)
Subject: Any danger in my program?
Dear all,
I am not sure about the danger of my program, could anyone please help
me?
Suppose,
// dbRef is the database with 100 records, each of size 15k
for (i=0;i<100;i++)
{
recordH=DmQueryRecord(dbRef,i);
recordPtr=MemHandleLock(recordH);
myPtr[i]=(CharPtr)recordPtr;
MemHandleUnlock(recordH);
}
Is it very unsafe to access myPtr after this FOR loop? Is the answer of
this question depends on whether I would have to create new record or
increasing the size of record after this FOR loop? OR, is the answer of
the question depends on whether I have plenty of free storage heap
memory or not?
I think I would just leave MemHandleUnlock to happen when I exit my
application. Am I correct?
Thank you very much!
philip