The OS automatically frees handles that are associated with the form's text
fields when the form is closed.  I think your problem is that when you
assign a new handle to your field, you're not freeing the old one.

Try doing this:
>      h = MemHandleNew(128);
>      p = MemHandleLock(h);
>      StrCopy(p, defaultText);
>      MemHandleUnlock(h);
Handle oldText = FldGetTextHandle(pFld); // get the old text handle
>      FldSetTextHandle(pFld, h);
if (oldText) MemHandleFree(oldText); // free the old text handle if it
exists

Your new handles will be freed automatically as long as they are associated
with a field.
Best of luck
Luca

----- Original Message -----
From: Richard Hartman <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: Palm Developer Forum <[EMAIL PROTECTED]>
Sent: Friday, February 25, 2000 4:00 PM
Subject: FldSetTextHandle() and OS 3.3


>
> I have a simple program that works (on POSE) w/ OS 3.0, but does not work
> with OS 3.3.  The problem is a dialog that reports:
>
>     "UIAppShell" (unknown version) reports "SystemMgr.c, Line 4192,
>     Possible memory leak.   Use the 'hd 0' command to find chunks owned
>     by your app.  These chunks have an ownerID of 2".  If this is the
latest
>     version of "UIAppShell", please report this to the application author.
>
> This error occurs when leaving the app.
>
> The app is a form w/ 3 fields.  At the opening of this form I initialize
> the fields like so:
>
>      h = MemHandleNew(128);
>      p = MemHandleLock(h);
>      StrCopy(p, defaultText);
>      MemHandleUnlock(h);
>      FldSetTextHandle(pFld, h);
>
> I even tried doing cleanup during the appStopEvent like so:
>
>      h = (VoidHand) FldGetTextHandle(pFld);
>      FldSetTextHandle(pFldStandard, NULL);
>      MemHandleFree(h);
>
> Again OS 3.0 is ok w/ this, but OS 3.3 reports the error.
>
> So ... what is the problem?  What has changed re. field
> text handles?
> >


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to