>When I run my program in POSE a second time, it always crashes.
>That is, I start the program, do a few things in the program, then I switch
>to the Applications Icons screen. When I click on the program's icon,
>it fails with an error message like this:
>
>"MemoryMgrNew.c, Line 4128, Invalid handle"
D. Fedor replies, in part:
>>Sounds like you're either messing up
>>your application's resources, or corrupting the memory manager, or
>>something along those lines. But without seeing your code, I wouldn't be
>>able to say.
Here's how I'm cleaning up in StopApplication():
static void StopApplication(void)
{
StarterPreferenceType prefs;
PrefSetAppPreferences (appFileCreator, appPrefID, appPrefVersionNum,
&prefs, sizeof (prefs), true);
FrmCloseAllForms();
if (pSessionID)
{
MemPtrFree ( pSessionID );
pSessionID = NULL;
}
if (pConfig)
{
MemPtrFree ( pConfig );
pConfig = NULL;
}
if (pConfigDB)
{
DmCloseDatabase((DmOpenRef) pConfigDB);
pConfigDB = NULL;
}
if (pSessionDB)
DmCloseDatabase((DmOpenRef) pSessionDB);
pSessionDB = NULL;
}
}
//----------------------------------------------------------------------
And here's where it crashes (most of the time). This is
in a function called by StartApplication(). I've added
a comment to the line where the debugger says the
crash happens. configHandle is 0x00000000, so I
do not understand how execution could enter that
if-block. configHandle is a local automatic variable,
and pConfig and pConfigDB are whole file static, or
what I sometimes call "semi-global".
. . . .
numRecords = DmNumRecords ( pConfigDB );
if ( numRecords != 1)
return (appErrorClass + 1);
configHandle = DmGetRecord(pConfigDB, 0);
if (configHandle)
{
pConfig = MemHandleLock(configHandle); // It crashes here.
if (pConfig)
MemHandleUnlock(configHandle);
else
return (appErrorClass + 1);
}
else
return (appErrorClass + 1);
DmReleaseRecord(pConfigDB, 0, 0);
//-------------------------------------------------------------
If you need more details about this problem, please
let me know.
Greg Bungo
[EMAIL PROTECTED]
(630)949-3250 voice
(630)949-3299 fax