"Simon Drabble" <[EMAIL PROTECTED]> wrote in message
news:33840@palm-dev-forum...
>
> Anyone know why this piece of code would cause a fatal exception on a real
> handheld (Palm V) but not on POSE running the same ROM?
>
> void DL_SetLocation(DrawLibType *dl, Int16 x, Int16 y, Int16 w, Int16 h)
>  {
>   Char buf[80];
>   Char buf2[80];
>
>   StrPrintF(buf, "%d %d", dl->rect.topLeft.x, dl->rect.topLeft.y);
>   StrPrintF(buf2, "%d %d", dl->rect.extent.x, dl->rect.extent.y);
> /* the next call displays four values, junk of course */
>   FrmCustomAlert(GEN_USER_ERROR_ALERT, "SetLocation", buf, buf2);
>
>   dl->rect.topLeft.x = x;                              // exception occurs
here
>   FrmCustomAlert(GEN_USER_ERROR_ALERT, "Set X", buf, buf2);
>   dl->rect.topLeft.y = y;
>   FrmCustomAlert(GEN_USER_ERROR_ALERT, "Set Y", buf, buf2);
>   dl->rect.extent.x = w;
>   FrmCustomAlert(GEN_USER_ERROR_ALERT, "Set W", buf, buf2);
>   dl->rect.extent.y = h;
>   FrmCustomAlert(GEN_USER_ERROR_ALERT, "Set H", buf, buf2);
>  }

Two ideas:  one, what happens if you remove the FrmCustomAlert call?  This
call uses the famous PrvFixupPointers internal call which can corrupt memory
in odd ways.

Also, I'm wondering if possibly the StrPrintF's are overwriting their
bounds, although with 80 characters for each, I'd really doubt they'd do
that.

I think its time to pull out the debugger and step through your code at the
assembly level, trying to see exactly what instruction caused the fatal
error.  I'd be curious to also inspect buf and buf2 at that time to make
sure they are OK.

--
Ben Combee
Veriprise Wireless <http://www.veriprise.com>



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