From: "druid" <[EMAIL PROTECTED]>
> testdb just read from memory location 0x0000324A
> which is in Memory Manager data structures
>
> Boolean handled = false;
> form = FrmGetActiveForm();
> FrmSetFocus(form, FrmGetObjectIndex(form, fldNewDesc));
> fldP = FrmGetObjectPtr(form, FrmGetObjectIndex(form, fldNewDesc));
> > crashes here on the third time this is called
> -> SysKeyboardDialog(0);
> FldDrawField(fldP);
> --
You're not testing return values at all so if either the FrmGetObjectIndex()
or FrmGetObjectPtr() calls fail (say because the resource files haven't
linked properly or fldNewDesc doesn't exist on the current form) then
all you'll get is a crash.

If you test fldP for null before trying to use it your code won't crash -
of course it won't do what you want, but at least you'll have more
chance of seeing what the problem is.

However, that's probably an aside since a crash the third time you're
doing something suggests that by the time you get here something
in the first two interations has corrupted memory or the heap.  The
problem might not be in this code at all.

Chris Tutty


-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to