Carlos.

You should first call MemHandleNew(size) where size should be big enougth to 
store the result of doubleToStr(), this may be also the problem of the 
memory leak you talked before, because you had a handle that point to a 
random address of memory that is not allocated for your use, then the memory 
leak error is announced because there was an address of memory that was used 
and never freed and if you try to free this addres you get the Free Handle 
error since you actually never allocated that memory address.

Since POSE only complains about accessing certain low addresses, may be this 
is the reason why POSE doesn't complains about it, if you set textH to NULL, 
POSE will complain.

The functions should go in pairs if you use MemHandelNew() you should call 
MemHandleFree(), same as when you called MemHandleLock() you called 
MemHandleUnlock().

Hope this helps.

Eduardo Orea.

"Carlos Gonzalez" <[EMAIL PROTECTED]> escribió en el mensaje 
news:[EMAIL PROTECTED]
> Eduardo,
>
> Here is part of my code and it is the only place where I use MemHandleLock 
> and unlock.. that is it.
>
> Boolean CalculateRisk()
> {
> ControlType* ctl;
> Boolean handled = true;
> MemHandle textH;
> char *str;
> double PI;
> ...
> PI += -1.236215274 - 2.598564382 - 2.119863737 + 8.600789247;
> PI = exp(PI);
> PI = (1.0 - pow(0.906,PI))* 100.0;
> str = MemHandleLock(textH);
> doubleToStr(str, PI, 2);
> MemHandleUnlock(textH);
> FldSetTextHandle(GetObjectPtr(MainFieldRisk),textH);
> FldDrawField(GetObjectPtr(MainFieldRisk));
> MemHandleFree(textH);
> return handled;
> }
>
> I really appreciate your help.
>
> Carlos
> 



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

Reply via email to