Yeah! I realized that after I posted it. But someone else already posted a correction telling me I'm wrong, so I didn't bother to make a follow up post. Sorry about that and thanks for explaining my error.
Anyways, I got mistaken with the original question and responded too quickly. On 28 Jan 2002 at 15:46, Bob Whiteman wrote: > John, > > It occurs to me that what you suggest has a subtle bug: > > > > MemHandle h; > void *p; > > h = MemHandleNew(100); > p = MemHandleLock(h); > > // Use p for a while > // ... > > MemPtrUnlock(p); > MemPtrFree(p); > > > > By the time your reach MemPtrFree, p is invalid. You should never reference a > pointer after the associated handle has been unlocked because it may move in > memory. > > Admittedly it's not very likely that the pointer will be moved if > MemPtrFree() immediately follows MemPtrUnlock, but it's still possible. > > Bob Whiteman > Senior Software Engineer > Pico Communications > > "John Leung" <[EMAIL PROTECTED]> wrote in message > news:74794@palm-dev-forum... > > > > For you second method, you'll still need to unlock the pointer with > > > > MemPtrUnlock(testPtr); > > > > -- > For information on using the Palm Developer Forums, or to unsubscribe, please > see http://www.palmos.com/dev/tech/support/forums/ > > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/