diff -r 965bb42340b2 -r 64200268cac2 mtpfws/mtpfw/src/cmtpobjectstore.cpp --- a/mtpfws/mtpfw/src/cmtpobjectstore.cpp Thu Sep 09 18:17:36 2010 +0800 +++ b/mtpfws/mtpfw/src/cmtpobjectstore.cpp Fri Sep 17 11:40:03 2010 +0800 @@ -140,8 +140,11 @@ delete iPkgIDStore; delete iSentinal; delete iSnapshotWorker; - TRAP_IGNORE(CommitTransactionL()); - iDatabase.Compact(); + if (iDbOpened) + { + TRAP_IGNORE(CommitTransactionL()); + iDatabase.Compact(); + } iBatched.Close(); iBatched_SuidHashID.Close(); CloseDb(); @@ -1004,9 +1007,19 @@ { BaflUtils::EnsurePathExistsL(iSingletons.Fs(), aFileName); - LEAVEIFERROR(iDatabase.Replace(iSingletons.Fs(), aFileName, KMTPFormat), - OstTrace0( TRACE_ERROR, CMTPOBJECTSTORE_CREATEDBL, " a new non-secure database create error!" )); - + iDbOpened = EFalse; + TInt err = iDatabase.Replace(iSingletons.Fs(), aFileName, KMTPFormat); + if ( KErrNone == err ) + { + iDbOpened = ETrue; + } + else + { + OstTrace0( TRACE_ERROR, CMTPOBJECTSTORE_CREATEDBL, + " a new non-secure database create error!" ); + User::Leave(err); + } + // Create table and index CreateHandleTableL(); CreateHandleIndexL();