Hello all,
I'm having a curious problem. My application needs to trap appStopEvents
in all but a few enumerated forms (I have a good reason to do so). When
the user tries to exit the application, it will instruct them to go back to
the Main Menu and exit from there, with an Alert Dialog (e.g.,
FrmCustomAlert). This works beautifully in all the forms, however my
application will crash with a memory error (not in my own code--at least
not according to debug) when:
A) I have an Alert Dialog (e.g., FrmCustomAlert) on the screen.
B) The user generates an appStopEvent.
C) I ignore the appStopEvent in the eventloop
D) I popup ANOTHER Alert Dialog in response- (tells the user why they can't
exit and how to do so). When I don't do this, as in merely comment out
that line, none of this happens!!!!!
After this:
A) The screen gets messed up. Form objects from the prior form (the one
that was partially visible during the appStopEvent) are visible on the new
one (as in the Main Screen).
B) When I move to other forms in my application, POSE crashes with a
memory error, saying that the application just read from an unallocated
chunk of memory. Also while this happens, I see part of the form where I
called the Alert dialog from (and maybe a field selected). Now I know this
particular memory error is not in my own code per se, it seems to be the
form or field manager or something to that effect that is trying to read
from the original form, even though it no longer exists (or does it?)
In any event, does anyone have any idea what the problem could be? How I
could work around it or fix the problem? Is there a better way to achieve
the same thing?
Any help will be greatly appreciated.
Thanks
Although I'm quit sure the problem isn't in my event loop (besides the
stated issue). This is my event loop:
static void AppEventLoop(void)
{
UInt16 error;
EventType event;
do {
EvtGetEvent(&event, evtWaitForever);
if (! SysHandleEvent(&event))
if (! MenuHandleEvent(0, &event, &error))
if (! AppHandleEvent(&event))
FrmDispatchEvent(&event);
} while (!QuitApplication &&
(event.eType!=appStopEvent||!ChooseToQuit(event.eType)));
}
static Boolean ChooseToQuit(eventsEnum eType)
{
switch(FrmGetActiveFormID()) {
case MainForm:
return true;
break;
case RegistrationForm:
return true;
break;
default:
// when this isn't commented out, everything crashes
// when it is, I have no problems
AlertUserWithString("You must return to Main Menu, then press
the
button, to exit!");
return false;
break;
}
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/