> From: Brian Smith
>
> void InitOneItem(FormPtr pForm, UInt8 nCurrentItem, UInt16 nGadgetIndex) {
>
>    UInt8 *pItem = MemPtrNew(sizeof(UInt8));
>    if (pItem != NULL) {
>       *pItem = nCurrentItem;
>       FrmSetGadgetData(pForm, nGadgetIndex, pItem);
>    }
>    MemPtrFree(pItem);
> }
>

MemPtrFree disposes a non-movable chunk of memory.  After you free the
memory, what makes you think that you can later use the pointer to that
memory?  (A: you can't, unless the memory hasn't yet been over-written with
something else.)

If you use a gadget to store a pointer to some data, you should make sure
that the data it is pointing to remains unchanged as long as you need it.


-- 
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