after adding few lines of new code .... first execution is fine, second
execution gives the the error : just read the directly from memory location
zero (NULL).

is it due to  the NULL parameter in line 9 .... any comment ?
how to solve this problem ?

> Code
> ====
>               ptxt = (Char*) MemPtrNew(MAX_HEX_INPUT+1);
>               StrCopy(ptxt,input[testIndex]);

                FldSetTextPtr(pfld,ptxt);       //pfld is non-editable field
                FldRecalculateField(pfld,true);
                FldDrawField(pfld);
>               ....
line 9: FldSetTextPtr(pfld,NULL);
> line10:       MemPtrFree(ptxt);
> line11:       if(ptxt)
> line12:               FrmCustomAlert(InfoAlert,"End of run",
> ptxt , " ");
>

Regards,
Tan Kuan Eeik
[EMAIL PROTECTED]



> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Tan
> Kuan Eeik
> Sent: Friday, July 13, 2001 10:58 AM
> To: Palm Developer Forum
> Subject: Mem Free - String Error
>
>
> I'm using gdb to debug...
> after line 10 , ptxt suppose to be free and inaccessible but
> it displays the
> following ptxt  value :
> (gdb) display ptxt
> 1: ptxt = 0xbeca
> "B8500C4C9F0E52EA414B7FD2D6D3353BB5EEA88676D7308BD8261ED7C12D38B5"
>
> subsequently, it execute line 11 and 12 which leads it to the error :
> directly read from unallocatable chunck of memory ....
>
> does it mean the ptxt already been free? If so,  ptxt should
> be null and
> line 12 should not be executed ...
>
> Can someone plz explain ...thanks.
>
> Code
> ====
>       ptxt = (Char*) MemPtrNew(MAX_HEX_INPUT+1);
>       StrCopy(ptxt,input[testIndex]);
>
>       ....
>
> line10 :      MemPtrFree(ptxt);
> line11:       if(ptxt)
> line12:               FrmCustomAlert(InfoAlert,"End of run",
> ptxt , " ");
>
>
>
> Regards,
> Tan Kuan Eeik
> [EMAIL PROTECTED]
>
>
> --
> 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/

Reply via email to