"Sebastian Voges" <[EMAIL PROTECTED]> wrote in message
news:44385@palm-dev-forum...
> "Alan Ingleby" <[EMAIL PROTECTED]> wrote in message
> news:44337@palm-dev-forum...
> >
> > Lately, my gremlin runs have been bombing out with a "Form.c, Line:177,
> Form
> > already loaded" error.  All my form switching is done using FrmGotoForm,
> and
> > I ignore all frmCloseForm events, making sure they get returned as
false.
> I
> > have looked through the archives, and KB, but to no avail..
> >
> > I'm sure I'm making an obvoius mistake somewhere, but can't see where.
To
> > point me in the right direction, can anyone list the common reasons for
> this
> > occurring?
>
> I am not sure if this is a common reason, but I had this error message
once,
> when I called FrmGotoForm(myForm) and the myForm form was currently
> active/displayed on the screen.
> Though the switching worked for a couple of thousand gremlin events, I
> eventually  got the error message you described. In my case that was not
> related to OS4 roms.
>
> Maybe post some code snippets...

My codebase is fairly huge, so I couldn't really post snippets without
posting fairly large blocks of code.  What I *can* do is show you the
EventHandler loop, which activates the new form, the **** indicates the line
which causes the crash.

static Boolean ApplicationHandleEvent(EventPtr event)
{
 FormPtr   frm;
 Int16   formId;
 Boolean   handled = false;

 if (event->eType == frmLoadEvent) {
  formId = event->data.frmLoad.formID;
  frm = FrmInitForm(formId); //********
  FrmSetActiveForm(frm);

[....]

I then go on to set the form handlers for the form etc... I'm pretty sure
this structure is common to most palm software.

I have worked around this bug be replacing the line which was causing the
crash with this:

  frm = FrmGetFormPtr(formId);
  if (!frm) {
   frm = FrmInitForm(formId);
  }

Here, I'm checking to see if the form is already loaded, and if it is, I
don't load it again... (But why is it *sometimes* already loaded, but not
other times???)

Running gremlins on this can cause a crash anywhere from 150 hits to 20000
hits.  When I manually try to duplicate the results, I can NEVER get it to
crash.

Regards,

Alan Ingleby
Systems Developer
ProfitLink Consulting Pty Ltd
309 Burwood Road
Hawthorn
Victoria 3122
Australia



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