mtpfws/mtpfw/src/cmtpconnection.cpp
branchRCL_3
changeset 40 453dfc402455
parent 19 ef55b168cedb
child 42 0aa8cc770c8a
--- a/mtpfws/mtpfw/src/cmtpconnection.cpp	Thu Jul 15 19:35:12 2010 +0300
+++ b/mtpfws/mtpfw/src/cmtpconnection.cpp	Thu Aug 19 10:44:03 2010 +0300
@@ -94,6 +94,12 @@
     	}
     
     iSessions.ResetAndDestroy();
+    
+    if (iTransportConnection != NULL)
+        {
+        iTransportConnection->Unbind(*this);
+        }
+    
     //close the property
     iProperty.Close();
     // delete the ‘name?property
@@ -357,7 +363,7 @@
             CompleteCloseConnection();
             ret = ETrue;
             }
-        
+          
         SetState(EStateShutdown);
         PublishConnState(EDisconnectedFromHost);   
         }
@@ -372,10 +378,6 @@
     
     CloseAllSessions();
     iSessions.Reset();
-	if (iTransportConnection != NULL)
-		{
-		iTransportConnection->Unbind(*this);
-		}
     
     //notify ConnectionMgr and corresponding transports of completion of connection close
     iSingletons.ConnectionMgr().ConnectionCloseComplete(iConnectionId);    
@@ -405,8 +407,12 @@
         */
         SessionOpenedL(KMTPSessionNone);            
         
+        if (iTransportConnection != NULL)
+            {
+            iTransportConnection->Unbind(*this);
+            }
         iTransportConnection = &aTransportConnection;
-        iTransportConnection->BindL(*this); 
+        iTransportConnection->BindL(*this);
         SetState(EStateOpen); 
          
         }
@@ -707,7 +713,7 @@
     iEventQ(_FOFF(CMTPEventLink, iLink)),
     iTransportConnection(&aTransportConnection)
     {
-    
+    iTransportConnection->BindL(*this);
     }
     
 /**