I am seeing a very strange problem with SysNotifyRegister and DmSetDatabaseInfo on the T3. I am using the collapse utilities, and the simplest case in which it occurs is this...

I have my applications "data" database. Call it "foo". I rename it.
Then I create a new database called "Foo", change the backup attribute, and delete it. (yes, I'm aware it doesn't make any sense to do that - this is just the simplest case)
Then I rename the old "data" database back to Foo.
The system then crashes on the T3 or the T3 Simulator with a
"MemoryMgr.c, Line:3651, Free handle". It seems to be crashing when the resize notification gets sent.
The callstack when it crashes is (going up):
PrvUpdateLaunchDBEntry->LaunchDBHandleSetInfo()->LaunchDBHandleSetInfo()->ProcessNotify()->PilotMain()->68K


The crash does NOT occur if I don't use DmSetDatabaseInfo() to change the backup attribute. I don't mind telling you, I am completely bewildered. Seems to have something to do with the databases getting shuffled around in memory.
Anyone have any clues?


// Rename the old database
const char* dataBackupName = "DataBackup";
LocalID databaseID = DmFindDatabase(0, DATABASE_NAME);
if (databaseID)
{
ASSERT(DmSetDatabaseInfo(0, databaseID, dataBackupName, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL) == 0);
}


// Create the new database with the same name, set the backup bit, then delete it.
ASSERT(DmCreateDatabase (0, DATABASE_NAME, CREATOR_ID, 'DATA', false) == 0);
databaseID = DmFindDatabase (0,DATABASE_NAME);
UInt16 attributes;
DmDatabaseInfo(0, databaseID, NULL, &attributes, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
attributes |= dmHdrAttrBackup;
DmSetDatabaseInfo(0, databaseID, NULL, &attributes, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
DmDeleteDatabase(0, databaseID);


// Now rename the old database back.
databaseID = DmFindDatabase(0, dataBackupName);
if (databaseID)
{
Err err = DmSetDatabaseInfo(0, databaseID, DATABASE_NAME, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
ASSERT(err == 0);
}

// Register for the notification. The crash occurs whether I call this before the "bad" code or afterwards.
CollapseAppStart(); // This calls SysNotifyRegister


--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to