Hello,

I'm writing an application to handle notifications even though it will not 
be running. On the sysAppLaunchCmdSystemReset launch code I allocate my 
globals and then register for notifications using SysNotifyRegister passing 
in a pointer to my callback function as well as a pointer to my globals...

MyGlobalsType* globalsP;
UInt16  cardNo =0;
LocalID dbID   =0;

globalsP = (MyGlobalsType*)MemPtrNew(sizeof(MyGlobalsType));
if (!globalsP) {
return NULL;
}
//set owner to system so that it persists
MemPtrSetOwner(globalsP, 0);
//register for notification
SysCurAppDatabase(&cardNo,&dbID);
SysNotifyRegister(cardNo, dbID, sysNotifyMenuCmdBarOpenEvent,
CommandBarOpenProc, sysNotifyNormalPriority, globalsP);

This code actually works fine, except under very low memory conditions it 
fails. I've isolated the problem to the globalsP pointer being freed or 
moved when a call to MemHeapCompact() is called. After
MemHeapCompact() is called, if I try to access my globals from within
CommandBarOpenProc a Fatal Exception will often occur.

I'm probably just not allocating the memory properly so please any help is 
appreciated.

Thanks,

Jason McCarty

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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