On Thu, 21 Dec 2000, Ben Combee wrote:
> "Simon Drabble" <[EMAIL PROTECTED]> wrote in message
> news:33840@palm-dev-forum...
> >
> > FrmCustomAlert(GEN_USER_ERROR_ALERT, "SetLocation", buf, buf2);
> > dl->rect.topLeft.x = x; // PalmV gets upset here
>
> 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.
Ben, thanks for your response.
I put the FrmCustomAlert() in there so I could see what is going on -- this is
what allowed me to narrow down the problem to the line indicated. I develop on
Linux so don't have access to a low-level debugger. (does gdb work with a
real palm or just POSE?)
>
> 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.
Doubtful, but for the sake of completeness I increased the buffers to 1024
bytes each -- no change. I also removed the FrmCustomAlert() calls and
StrPrintF()'s with no joy.
>
> 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.
Any ideas of the best way to go about this on Linux? Should I use m68kdis or
similar?
Breaking news: I just tried creating a new RectangleType in DL_SetLocation()
and using that instead of dl->rect -- surprise, it worked. So it seems somehow
dl is getting smashed. Here's how it gets set up:
Handle hand = MemHandleNew(sizeof(DrawLibType));
DrawLibType *dl = MemHandleLock(hand);
if (hand == NULL || dl == NULL) return NULL;
So far I have yet to encounter a NULL return, so it seems dl gets initialised
ok.
Even breakingier news: Removing a MemSet() call to zero out the textBuffer
field of dl solved the problem. Seems I must have been overwriting dl->rect
with that call. D'oh.
Thanks for your help.
Simon.
>
> --
> Ben Combee
> Veriprise Wireless <http://www.veriprise.com>
>
--
This message brought to you by a varying amount of tangible Monty Python
sketches.
Simon Drabble It's like karma for your brain.
[EMAIL PROTECTED]
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/