Some memory usage improvements to daemon.
[jenirok] / src / common / connectionmanager.cpp
index 14c0b0a..07f277e 100644 (file)
@@ -45,6 +45,19 @@ timer_(0)
 
 }
 
+ConnectionManager::~ConnectionManager()
+{
+    QDBusConnection systemBus = QDBusConnection::systemBus();
+
+    systemBus.disconnect(ICD_DBUS_API_INTERFACE, ICD_DBUS_API_PATH,
+                         ICD_DBUS_API_INTERFACE, ICD_DBUS_API_STATE_SIG,
+                         this, SLOT(stateChange(const QDBusMessage&)));
+
+    systemBus.disconnect(ICD_DBUS_API_INTERFACE, ICD_DBUS_API_PATH,
+                         ICD_DBUS_API_INTERFACE, ICD_DBUS_API_CONNECT_SIG,
+                         this, SLOT(connectionChange(const QDBusMessage&)));
+}
+
 bool ConnectionManager::connect()
 {
     ready_ = false;
@@ -99,39 +112,30 @@ void ConnectionManager::stateChange(const QDBusMessage& rep)
     switch(status)
     {
     case ICD_STATE_CONNECTING:
-        qDebug() << "Connecting";
         break;
     case ICD_STATE_CONNECTED:
         connected_ = true;
         ready_ = true;
-        qDebug() << "Connected";
         break;
     case ICD_STATE_DISCONNECTING:
-        qDebug() << "Disconnecting";
         break;
     case ICD_STATE_DISCONNECTED:
         connected_ = false;
         ready_ = true;
-        qDebug() << "Disconnected";
         break;
     case ICD_STATE_LIMITED_CONN_ENABLED:
         connected_ = true;
         ready_ = true;
-        qDebug() << "Limited connection enabled";
         break;
     case ICD_STATE_LIMITED_CONN_DISABLED:
         connected_ = false;
         ready_ = true;
-        qDebug() << "Limited connection disabled";
         break;
     case ICD_STATE_SEARCH_START:
-        qDebug() << "Search start";
         break;
     case ICD_STATE_SEARCH_STOP:
-        qDebug() << "Search stop";
         break;
     case ICD_STATE_INTERNAL_ADDRESS_ACQUIRED:
-        qDebug() << "Internal address acquired";
         break;
     default:
         qDebug() << "Unknown connection status";
@@ -149,17 +153,14 @@ void ConnectionManager::connectionChange(const QDBusMessage& rep)
     case ICD_CONNECTION_SUCCESSFUL:
         connected_ = true;
         ready_ = true;
-        qDebug() << "Connection successful";
         break;
     case ICD_CONNECTION_NOT_CONNECTED:
         connected_ = false;
         ready_ = true;
-        qDebug() << "Connection not connected";
         break;
     case ICD_CONNECTION_DISCONNECTED:
         connected_ = false;
         ready_ = true;
-        qDebug() << "Connection disconnected";
         break;
     default:
         qDebug() << "Unknown connection status";