A follow-up for those who are interested:
The thing that seems to solve the problem is a new DmFindDatabase call when
DmSetDatabaseInfo returns an error different from dmErrAlreadyExists plus a
rename retry.
The most important lesson is perhaps that the LocalID returned from
DmFindDatabase may be invalidated in the following call to a service that
performs more complex DB operations. (E.g. DmSetDatabaseInfo must scan all
DB headers to check for the duplicates.)
Regards,
Jan Slodicka
----- Original Message -----
From: "Jan Slodicka" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[email protected]>
Sent: Sunday, May 01, 2005 1:47 AM
Subject: Another NVFS surprise on T5
> This code may produce memChunkUnderlocked fatal alert:
>
> LocalID dbID = DmFindDatabase( 0, oldName ) ;
> if( dbID != NULL )
> {
> err = DmSetDatabaseInfo( 0, oldDbID,
> newName,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) ;
> if( err != 0 ) // this works: if( err == dmErrAlreadyExists )
> err1 = DmSetDatabaseInfo( 0, oldDbID,
> anotherName,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) ;
> }
>
> Problem happens when err denotes some vfs error (vfs!!!; e.g. 0x2A06).
> Happens also when the DbCache is empty.
>
> I don't ask for the explanation - it is easily imagineable.
>
> The last months were for sure my worst programming experience I ever made.
> (I started many years ago with Fortran on PDP and came across several
OS's,
> several languages, several compilers. Nothing compares to this NVFS
> implementation.)
>
> Jan Slodicka
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/