Discussion:
[libnm-qt] /: Avoid infinite loop when emitting connectionRemoved signal.
Lamarque V. Souza
2012-08-08 11:59:39 UTC
Permalink
Git commit c445bcee6957e58dea6f16eb80b456a7d4926abb by Lamarque V. Souza.
Committed on 08/08/2012 at 13:52.
Pushed by lvsouza into branch 'master'.

Avoid infinite loop when emitting connectionRemoved signal.

CCMAIL: kde-networkmanager at kde.org

M +3 -3 settings.cpp
M +1 -1 settings_p.h

http://commits.kde.org/libnm-qt/c445bcee6957e58dea6f16eb80b456a7d4926abb

diff --git a/settings.cpp b/settings.cpp
index 634ee7b..aa23312 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -149,12 +149,12 @@ NetworkManager::Settings::Connection* NetworkManager::Settings::SettingsPrivate:
} else {
rc = new NetworkManager::Settings::Connection(path, this);
connections.insert(path, rc);
- connect(rc, SIGNAL(removed(QString)), this, SLOT(connectionRemoved(QString)));
+ connect(rc, SIGNAL(removed(QString)), this, SLOT(onConnectionRemoved(QString)));
}
return rc;
}

-void NetworkManager::Settings::SettingsPrivate::connectionRemoved(const QString &path)
+void NetworkManager::Settings::SettingsPrivate::onConnectionRemoved(const QString &path)
{
NetworkManager::Settings::Connection *rc = connections.take(path);
emit connectionRemoved(path);
@@ -165,7 +165,7 @@ void NetworkManager::Settings::SettingsPrivate::daemonUnregistered()
{
QMap<QString, Connection*>::const_iterator i;
for (i = connections.constBegin(); i != connections.constEnd(); ++i) {
- connectionRemoved(i.key());
+ onConnectionRemoved(i.key());
}
connections.clear();
}
diff --git a/settings_p.h b/settings_p.h
index f4eacc5..295ba57 100644
--- a/settings_p.h
+++ b/settings_p.h
@@ -52,7 +52,7 @@ namespace Settings
OrgFreedesktopNetworkManagerSettingsInterface iface;
protected Q_SLOTS:
void slotConnectionAdded(const QDBusObjectPath &);
- void connectionRemoved(const QString &);
+ void onConnectionRemoved(const QString &);
void propertiesChanged(const QVariantMap &);
void onConnectionAddArrived(QDBusPendingCallWatcher *);
void daemonUnregistered();

Loading...