I have a strange problem that I am just not seeing. Any help would be
appreciated. I am using GCC and POSE 2.1d26. Here is the scenario: I
have an app that (among other things) does some periodic processing
triggered by an alarm. Here is the SetAlarm proc which simply sets the
alarm if one does not already exist:
----------
static void SetAlarm(void)
{
UInt cardNo;
LocalID dbID;
DmSearchStateType searchInfo;
DWordPtr refP;
ULong alarmTime = 0;
DmGetNextDatabaseByTypeCreator(true, &searchInfo,
sysFileTApplication, kCreatorID, true, &cardNo, &dbID);
// alarmTime = AlmGetAlarm(cardNo, dbID, refP);
// if (alarmTime == 0)
// {
alarmTime = TimGetSeconds() + 3600;
AlmSetAlarm(cardNo, dbID, 0, alarmTime, true);
// }
}
----------
Here is the problem. As you see it above (no check for existing
alarm), the app runs fine. If however, I put the 4 commented-out lines
back in, the app will blow up. However it does not blow up until you
EXIT the app the second time (which is the first time you exit the app
with an alarm already existing). Hope that is not confusing -
basically the flow is you run the app first time, it see's no alarm
exists and sets one. Now you leave and run the app again. It sees an
alarm does exist so does not try to set a new one and the app continues
as expected. When you exit the app that second time, it will blow up.
The error from POSE when exiting is:
The current application (unknown version) has failed. "MemoryMgrNew.c,
Line 3970, Invalid handle"
If I follow the execution of this thing within gdb, you can see
everything executes just fine and watch it leave PilotMain, then the
error occurs. I can't see why the above code would cause this.
Thank you in advance,
Jason
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com