on 2/19/01 10:40 AM, Matt Mason at [EMAIL PROTECTED] wrote:
> When I change the label on a popup trigger with this:
> {
> CharPtr s = MemPtrNew(sizeof(char[MAX_ITEM_PRICE_SIZE]));
> MemSet(s,MAX_ITEM_PRICE_SIZE,0);
> s = StrIToA(s,qty);
> CtlSetLabel(GetObjectPtr(ItemEditQtyPopTrigger),s);
> MemPtrFree(s);
> }
> and then try to use the popup trigger on the form, I get an error reading
> from an unallocated chunk.
>
> What am I doing wrong?
>
You're deallocating the label. CtlSetLabel takes the pointer you pass it and
saves it. As soon as it does that, though, you're turning around and
deallocating it. Remove the call to MemPtrFree and your error will go away
(at some point, however, you'll need an appopriate place to free it).
--
Neil Rhodes
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/