OSDN Git Service

Maemo: Fix SFTP channel leak.
authorChristian Kandeler <christian.kandeler@nokia.com>
Mon, 8 Nov 2010 17:14:09 +0000 (18:14 +0100)
committerChristian Kandeler <christian.kandeler@nokia.com>
Mon, 8 Nov 2010 17:14:43 +0000 (18:14 +0100)
Reviewed-by: dt
src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp

index 84fdd1c..d6ba3df 100644 (file)
@@ -169,18 +169,6 @@ void MaemoRemoteMounter::handleUnmountProcessFinished(int exitStatus)
 void MaemoRemoteMounter::stop()
 {
     setState(Inactive);
-    if (m_utfsClientUploader) {
-        disconnect(m_utfsClientUploader.data(), 0, this, 0);
-        m_utfsClientUploader->closeChannel();
-    }
-    if (m_mountProcess) {
-        disconnect(m_mountProcess.data(), 0, this, 0);
-        m_mountProcess->closeChannel();
-    }
-    if (m_unmountProcess) {
-        disconnect(m_unmountProcess.data(), 0, this, 0);
-        m_unmountProcess->closeChannel();
-    }
 }
 
 void MaemoRemoteMounter::deployUtfsClient()
@@ -456,8 +444,21 @@ void MaemoRemoteMounter::assertState(const QList<State> &expectedStates,
 
 void MaemoRemoteMounter::setState(State newState)
 {
-    if (newState == Inactive)
+    if (newState == Inactive) {
         m_utfsServerTimer->stop();
+        if (m_utfsClientUploader) {
+            disconnect(m_utfsClientUploader.data(), 0, this, 0);
+            m_utfsClientUploader->closeChannel();
+        }
+        if (m_mountProcess) {
+            disconnect(m_mountProcess.data(), 0, this, 0);
+            m_mountProcess->closeChannel();
+        }
+        if (m_unmountProcess) {
+            disconnect(m_unmountProcess.data(), 0, this, 0);
+            m_unmountProcess->closeChannel();
+        }
+    }
     m_state = newState;
 }