On Thu, 2003-07-31 at 16:30, kcorey wrote:
> Anyone run into a situation where you've popped up a form on top of
> another form, and when you call FrmReturnToForm(0), you crash with an
> invalid memory location access? It particularly frustrating because it
> just started happening out of the blue.
Just to respond to my own post for the benefit of the archives...
What happened is that I'd changed to using the debug ROMs, and
FrmReturnToForm(0) (without returning TRUE in the event handler) can
tickle a bug in the debug ROMs (as well as crashing on my Tungsten|T and
Clie NR70).
To make this work, you must return TRUE from the event handler where
you're calling FrmReturnToForm(0). This seems to fix the problem in the
emulator, and on my Clie NR70 and Tungsten|T as well.
Interestingly, he recommends giving PopupForm a miss altogether and
using FrmDoDialog instead. I've asked for some more clarification, but
nothing yet.
-Ken
Here's PalmSource's full answer:
----------------------------------------------------------------------
>From the modal/child form's handler, after calling FrmReturnToForm(0);
are you returning that the form handler has handled the event. If not,
you will get a free pointer error and then a bus error on debug ROMs. It
will pass through on release ROMs. Assuming you are calling
FrmReturnToForm in response to a button tap, it should look like:
case ctlSelectEvent:
switch (eventP->data.ctlSelect.controlID)
{
case OtherBackButton:
FrmReturnToForm(0);
handled = true; //RETURN TRUE!
break;
If you are doing this correctly then maybe we ought to make sure that
the active form you are returning to is what you expect. Try replacing
the FrmReturnToForm(0); with an explicit form ID of a form to retun to.
Or maybe callFrmGetActiveFormId(); to make sure that you are returning
to where you think you should be...
If neither of these suggestions seems to lead to a solution, can you
minimize the crash to a small sample application or does it only occur
in the context of your larger application?
Also... on another note, unless you have good reason to use
FrmReturnToForm, I would avoid it. I would use FrmDoDialog with an event
handler before I messed with FrmPopupForm(). I have seen a decent amount
of developers struggle with the latter.
-Ezekiel Sanborn de Asis
PalmSource Developer Support
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/