diff -r 00c7ae862740 -r d845db10c0d4 emailservices/emailstore/message_store/server/src/MessageStoreSession.cpp --- a/emailservices/emailstore/message_store/server/src/MessageStoreSession.cpp Fri Jul 02 15:55:16 2010 +0300 +++ b/emailservices/emailstore/message_store/server/src/MessageStoreSession.cpp Fri Jul 09 12:17:13 2010 +0300 @@ -112,10 +112,16 @@ { __LOG_ENTER( "CreateL" ) - iServer.AddSession( this ); + iServer.AddSessionL( this ); // This could leave if a session is created while the store is unavailable. - TRAP_IGNORE( iServer.MessageStoreL().ObserveL( this ) ); + TRAPD( err, iServer.MessageStoreL().ObserveL( this ) ); + + if( err != KErrNone ) + { + iServer.DropSession( this ); + User::Leave( err ); + } __LOG_EXIT } // end CreateL @@ -694,12 +700,16 @@ event.iOtherId = KMsgStoreInvalidId; event.iFlags = KMsgStoreFlagsNotFound; - iEventQueue.Append( event ); + // return value can be ignored because queueing is very rare + // case anyway and appending T-class into RArray should succeed + TInt ignore = iEventQueue.Append( event ); } else { __LOG_WRITE_INFO( "event queued" ) - iEventQueue.Append( aEvent ); + // return value can be ignored because queueing is very rare + // case anyway and appending T-class into RArray should succeed + TInt ignore = iEventQueue.Append( aEvent ); } // end if } else @@ -1064,7 +1074,7 @@ void CMessageStoreSession::DoMatchFoundL( TContainerId aMessageId, TContainerId aFolderId, const TDesC8& aPropertyBuf ) { CSearchResult* result = CSearchResult::NewL( aMessageId, aFolderId, aPropertyBuf ); - iMatchMessages.Append( result ); + iMatchMessages.AppendL( result ); SendMatchesToClient(); } // end MatchFound @@ -2185,7 +2195,7 @@ TBool inMemorySort = aMessage.Int3(); TContainerId sessionId = iServer.MessageStoreL().StartSortingL( sortCriteria, iPropertyNames, inMemorySort ); - iSortSessionIds.Append( sessionId ); + iSortSessionIds.AppendL( sessionId ); TPckg sessionIdPckg( sessionId ); aMessage.WriteL( 0, sessionIdPckg ); @@ -2582,7 +2592,7 @@ CMruAddress* mruAddress = CMruAddress::NewL(0, addressDes, dispNameDes ); - iMruAddressArray.Append( mruAddress ); + iMruAddressArray.AppendL( mruAddress ); } // end while @@ -2724,11 +2734,12 @@ aMessage.ReadL( aIndex, length16Pckg, position ); position += length16Pckg.Length(); - HBufC8* buf8 = HBufC8::NewL( length16 ); - aArray.Append( buf8 ); + HBufC8* buf8 = HBufC8::NewLC( length16 ); TPtr8 buf8Ptr( buf8->Des() ); aMessage.ReadL( aIndex, buf8Ptr, position ); buf8->Des().SetLength( length16 ); + aArray.AppendL( buf8 ); + CleanupStack::Pop(buf8); position += length16; } // end while } @@ -2755,7 +2766,7 @@ if ( readBuf.MaxLength() < length16 ) { - readBuf.ReAlloc( length16 ); + readBuf.ReAllocL( length16 ); } aMessage.ReadL( aIndex, readBuf, position ); @@ -2763,7 +2774,9 @@ const TUint16* valuePtr = reinterpret_cast( readBuf.Ptr() ); TPtrC valueDes( valuePtr, length16 / 2 ); - aArray.Append( valueDes.AllocL() ); + HBufC *p = valueDes.AllocLC(); + aArray.AppendL( p ); + CleanupStack::Pop( p ); position += length16; } // end while @@ -2784,7 +2797,7 @@ for( position = 0; position < aMessage.GetDesLengthL( aIndex ); position += idPckg.Length() ) { aMessage.ReadL( aIndex, idPckg, position ); - aArray.Append( id ); + aArray.AppendL( id ); } // end for }