Greetings,
I am getting a bus error when I try to set a field text handle an
then update the field. Below is a code fragment. The error is occurring
somewhere in the bowels of the OS at the FldDrawField(fldP) line.
I am using:
o PalmOS Emulator, 3.0a7 (also happens in 3.0a6)
o ROM version palmos35-dr4-en-ezdbg
o Codewarrior for Palm R6
o 3.1, C Stationary
Please note that I am using the 3.5 ROM, but CodeWarrior 3.1 C
stationary. I need to use the 3.1 C stationary (the original
error is happening in a legacy app), and so I am using
Pilot.h (vice PalmOS.h) because I need to support older
devices. Is there a disagreement between the newer ROMs and
code compiled for the earlier OS's?
The error does _not_ happen when I use non-debug ROMs. Is there a
problem with palmos35-dr4-en-ezdbg? It does not happen, for example,
with palmos35-dr4-en-ez. On the Palm site, they say that you should
trust the debug rom's over the non-debug ROMs, but, frankly,
I'm at my wit's end and beginning to distrust the ROM.
Here is the code. Obviously, there a form (Form2) and it
contains a multi-line field Form2FldField (and that's all it
has). This is being called when the field is opened. I have
tried a number of variations, playing with pointers and
handles, etc., but to no avail. Any help would be greatly
appreciated.
Thanks,
Clark
static void Form2FormInit( FormPtr formP )
{
FieldPtr fldP;
Handle oldTxtH;
Handle txtH;
CharPtr txtP;
Char strP[12];
FieldAttrPtr attrP=NULL;
StrCopy( strP, "1234567890\0" );
fldP = GetObjectPtr(Form2FldField);
// get some space in which to stash the string.
txtH = MemHandleNew(StrLen(strP) + 1);
txtP = MemHandleLock(txtH);
// copy the string.
StrCopy(txtP, strP);
MemHandleUnlock(txtH);
txtP = 0;
// get the field and the field's current text handle.
oldTxtH = FldGetTextHandle(fldP);
// set the field's text to the new text.
FldSetTextHandle(fldP, txtH);
FldDrawField(fldP);
// free the handle AFTER we call FldSetTextHandle().
if ( oldTxtH != NULL ) MemHandleFree( oldTxtH );
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/