the code is in method call run()
run()
{
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 , " ");
}

and it will be executed each time i call run()

testIndex will be incremented on each call ...


Regards, 
Tan Kuan Eeik 
[EMAIL PROTECTED] 



> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Aaron
> Peter
> Sent: Friday, July 13, 2001 12:34 PM
> To: Palm Developer Forum
> Cc: [EMAIL PROTECTED]
> Subject: Re: Mem Free - String Error
> 
> 
> Hi,
>     Is that ur reading the same  variable in the second run 
> and it is giving
> error ?
> 
> -Peter
> 
> 
> > 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/

Reply via email to