metadataengine/server/src/mdsserversession.cpp
changeset 21 50bf9db68373
parent 20 6dfc5f825351
child 23 33ae025ac1e8
--- a/metadataengine/server/src/mdsserversession.cpp	Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdsserversession.cpp	Fri Apr 16 15:23:55 2010 +0300
@@ -115,6 +115,12 @@
 		return;
 		}
 
+    if( iServer.ShutdownInProgress() )
+        {
+        aMessage.Complete( KErrServerTerminated );
+        return;
+        }
+	
     TRAPD( err, ServiceFunctionL( aMessage ) );
     if( err != KErrNone )
         {
@@ -638,12 +644,10 @@
     CMdSFindEngine* findEngine = NULL;
 
     const TUint32 queryId = (TUint32)aMsg.Int0();
-
-    const TInt count = iFindEngines.Count();
-
+    
     TInt feIndex = 0;
 
-    for( TInt i = 0; i < count; i++ )
+    for( TInt i = iFindEngines.Count() - 1; i >=0; i-- )
     	{
     	if( queryId == iFindEngines[i]->QueryId() )
     		{
@@ -684,9 +688,7 @@
     
     const TUint32 queryId = (TUint32)aMsg.Int0();
 
-    const TInt count = iFindEngines.Count();
-    
-    for( TInt i = 0; i < count; i++ )
+    for( TInt i = iFindEngines.Count() - 1; i >=0; i-- )
     	{
     	CMdSFindEngine* findEngine = iFindEngines[i];
 
@@ -1195,10 +1197,8 @@
 void CMdSServerSession::ShutdownL( const RMessage2& /*aMsg*/ )
     {
     __LOGLB( ELogServer, "-> Shutdown session" );
-    
-    const TInt count = iFindEngines.Count();
-    
-    for( TInt i = 0; i < count; i++ )
+
+    for( TInt i = iFindEngines.Count() - 1; i >=0; i-- )
         {
         CMdSFindEngine* fe = iFindEngines[i];