>I have two fields on a frmDoDialog form being written to from a
>database.  The fields are set to be non-editable, as I am wanting to only
>display the contents.  Problems is this: I can tap the field and
>backspace.  When doing this, PalmOS issues a fatal error from the MemoryMgr.
>
>I thought it was due to something as above, but I'm afraid it's
>different.  I would appreciate some analysis of the problem.
>
>TIA.
>
>My concern are the two lines below, as they are never unlocked in the code:
>
>listStudentName[itemNum] = (Char*)MemHandleLock(MemHandleNew ( StrLen(
>item->name ) + 1 ) );
>listGender[itemNum] = (Char*)MemHandleLock(MemHandleNew ( StrLen(
>item->gender ) + 1) );

1. FldSetTextPtr verifies that the field is not editable, and 
displays a fatal alert on debug ROMs if that isn't the case. In your 
example, I'm assuming that it's also single-line (if not, it should 
be, otherwise you need to call FldRecalculateField after calling 
FldSetTextPtr).

Given that it's not editable (I assume you're running on a debug ROM 
- including the ROM version/name in postings is helpful), I'm not 
sure why you'd get a fatal error from the Memory Mgr. A stack crawl 
would be very useful here.

2. FldFreeMemory (called by the form code on field objects) will 
_not_ release the memory used by a text pointer. So in your example, 
I think you're leaking the memory allocated for the student name and 
gender.

-- Ken

Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200

-- 
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