Scratch this...
----- Original Message -----
From: "Del Ventruella" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[email protected]>
Sent: Tuesday, November 22, 2005 5:35 AM
Subject: Deleting List Object Array before Abrupt Close
> I am able to delete a list object array (containing the strings in shown
in the list) by calling a function to do when "Exit" is selected and the
form on which the list appears is exited via a menu or an object related
function that causes another form to appear. If I try to call the same
function to free the memory associated with the list object array from a
FrmCloseForm event, which happens when the user abruptly transfers from the
program to the main listing of all programs on the Palm emulator, I get an
error message telling me that memory is being accessed that is deleted. If
I don't try to free the array memory, I get a memory leak. I'm not entirely
sure why this is happening. Method works with exit to another form within
program, but doesn't if user exits program entirely.
>
> Thanks for any expert insight into the cause. Code (which works) to clear
array is:
>
> void FreeStrings(int j)
> {
> UInt16 i;
> if (gStringsPtrArray)
> {
> for(i = 0;i <j; i++)
> {
> if (gStringsPtrArray[i])
> MemPtrFree(gStringsPtrArray[i]);
> }
> MemPtrFree(gStringsPtrArray);
> }
> }
>
> I use the number of items in the database (DmNumRecords()) as the integer
in the call to the function, passing it by variable. If I pass a constant
number corresponding to the number of records (say 2), instead of a named
variable, FreeStrings seems to work. (At least I don't get the memory
access errors.) Is there some way to fix this? I am showing six strings in
the list, but the possible number is greater. Am I missing some aspect of
how this string array and list object work?
> --
> For information on using the PalmSource Developer Forums, or to
unsubscribe, please see http://www.palmos.com/dev/support/forums/
>
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/