hello keith and others, 

i have a strange error for you.  it involves pose (d26).  i was working
on a bit of code with a CharPtr.  i used StrIToA to set the CharPtr, and
then i wrote on the form with that.  worked fine.
hours later, i had a good prototype to try on a real device.  it crashed
every time with a fatal exception, but it didnt crash in pose.  it took
me over an hour to track down the fact that i had not used MemPtrNew on
the CharPtr.  when i tried this, it worked fine on both.

so anyway, the error in pose is that it allowed an uninitialized ptr to
be written to, when a real device crashes fatally everytime.

here is the problem in code:

static void SetFieldInt(Int fieldID, UInt value) 
{
        FieldPtr fld;
        CharPtr strP;
        FormPtr frm = FrmGetActiveForm();
/* this function crashes a real device, but not pose, with these lines
commented out */
//      strP=MemPtrNew(sizeof(CharPtr));
        StrIToA(strP, value);
        fld = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, fieldID));
        FldDelete(fld, 0, FldGetTextLength(fld));
        FldInsert(fld, strP, StrLen(strP));
//      MemPtrFree(strP);
}

:P

Reply via email to