FldSetTextHandle does not free the previous handle associated with the
field. Also your call to MemHandleFree(textH) is going to cause all sorts
of problems because the text field is going to try and work with a handle
you already freed. The text field will free the handle when the field
itself is freed.
Code sample:
MemHandle oldTxtH;
// Retrieve the current handle
oldTxtH = FldGetTextHandle(GetObjectPtr(MainFieldRisk));
// Set the new handle here
FldSetTextHandle(GetObjectPtr(MainFieldRisk));
// Free the previous handle
If (oldTxtH != NULL)
MemHandleFree(oldTxtH);
If you want more information on the proper use of FldSetTextHandle you
should check out the Palm OS Reference documentation.
Jason
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Carlos Gonzalez
Sent: Friday, May 26, 2006 3:33 PM
To: Palm Developer Forum
Subject: Re: Memory Leak
Eduardo thanks, this is my original code but, still giving me the same
error.. It alway gives the erro when I run it twice the function... the
second time gives me this error:.. MemoryMgr.c, Line 4384, Free Handle...
...
PI += -1.236215274 - 2.598564382 - 2.119863737 ;
PI = exp(PI);
PI = (1.0 - pow(0.906,PI))* 100.0;
textH = MemHandleNew(8);
str = MemHandleLock(textH);
doubleToStr(str, PI, 2);
MemHandleUnlock(textH);
FldSetTextHandle(GetObjectPtr(MainFieldRisk),textH);
FldDrawField(GetObjectPtr(MainFieldRisk));
MemHandleFree(textH);
return handled;
}
Carlos
--
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/