imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp
branchRCL_3
changeset 28 ff2fb7658ff7
parent 21 ad31f4183ddc
child 37 f759b6186ab5
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp	Wed Jun 09 10:01:32 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp	Mon Jun 21 16:00:46 2010 +0300
@@ -120,6 +120,7 @@
         // create processor
         if(iProcessor)
             {
+            iProcessor->Shutdown();
             delete iProcessor;
             iProcessor = NULL; 
             }
@@ -179,6 +180,7 @@
     
     if (iProcessor)
         {
+        iProcessor->Shutdown();
         delete iProcessor;
         iProcessor = NULL;
         }
@@ -281,26 +283,24 @@
 void CThumbAGDaemon::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
     {
     TN_DEBUG2( "CThumbAGDaemon::HandleSessionError == %d", aError );
-    if (aError != KErrNone && !iSessionError)
+    if (aError != KErrNone && !iShutdown && !iSessionError)
         {
         iSessionError = ETrue;
     
         // kill processor right away, because it also has MdESession
         if(iProcessor)
             {
+			iProcessor->Shutdown();
             delete iProcessor;
             iProcessor = NULL; 
             }
     
-        if (!iShutdown)
+        if (!iReconnect->IsActive())
             {
-            if (!iReconnect->IsActive())
-                {
-                iReconnect->Start( KMdEReconnect, KMdEReconnect, 
-                                   TCallBack(ReconnectCallBack, this));
-                
-                TN_DEBUG1( "CThumbAGDaemon::HandleSessionError() - reconnect timer started" );
-                }
+            iReconnect->Start( KMdEReconnect, KMdEReconnect, 
+                               TCallBack(ReconnectCallBack, this));
+            
+            TN_DEBUG1( "CThumbAGDaemon::HandleSessionError() - reconnect timer started" );
             }
 
         }   
@@ -319,6 +319,11 @@
     {
     TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - begin" );
     
+    if(!iProcessor || iShutdown)
+        {
+        return;
+        }
+    
     if(aType == ENotifyRemove)
         {
         TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - removed");