I have a list control tied to a popup trigger.  I dynamically load the
contents of the list control with no problem.

I populate char* ListStr[] from the db (using MemPtrNew and StrCopy) and
maintain it as a static array, then populate the list in the easy way - not
using any custom draw function callbacks.

        LstSetListChoices (lstP, ListStr, NumItems);
        LstSetHeight (lstP, NumItems);

When the user selects an item from another list on the form, I need to
repopulate the list control with a new list.  I do this in the
popSelectEvent of the first list.  So when this happens, I free the
ListStr[] pointers, then repopulate it with a new set of strings, and call
LstSetListChoices and LstSetHeight again with the new values.  This works
fine for a few times, but then I eventually get an error is POSE that it is
reading from an unallocated chunk of memory.  What it appears to be doing
when the error happens is refreshing the label in the trigger control from
the old ListStr[] pointer which of course no longer exists.  I can't seem to
track what it is exactly doing but it is not happening in my code anywhere.
The stack shows:

0x10C718A6( FrmDispatchEvent )
0x10C6DF24( PrvSendEventToForm )
0x10C72E18( FrmHandleEvent )
0x10C63430( CtlHandleEvent )
0x10C62952( PrvDrawControl )
0x10C62952( PrvDrawControl )
0x10C1E808( StrLen )

Specifically what happens is I choose and item from the first list, I
populate the second list, choose an item in the second list - do this three
times and I get the error when I click on the second list before it
displays.

Any ideas would be appreciated.

-Dave




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

Reply via email to