libnm bug: recursive loop when connection gets removed

Christophe Oosterlynck christophe.oosterlynck at dzine.be
Wed Aug 8 09:48:33 UTC 2012


Hi,

connectionRemoved() is both defined as a signal in the base class Notifier
and as a slot in the deriving class SettingsPrivate. The signal is being
emitted from the function itself => recursive call of that function.

Diff at the end of the mail with a fix.

Best regards,

Christophe

diff -r 9f062f9781ab settings.cpp
--- a/settings.cpp Wed Aug 08 11:39:59 2012 +0200
+++ b/settings.cpp Wed Aug 08 11:45:10 2012 +0200
@@ -145,12 +145,12 @@
     } 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(slotConnectionRemoved(QString)));
     }
     return rc;
 }

-void NetworkManager::Settings::SettingsPrivate::connectionRemoved(const
QString &path)
+void
NetworkManager::Settings::SettingsPrivate::slotConnectionRemoved(const
QString &path)
 {
     NetworkManager::Settings::Connection *rc = connections.take(path);
     emit connectionRemoved(path);
@@ -161,7 +161,7 @@
 {
     QMap<QString, Connection*>::const_iterator i;
     for (i = connections.constBegin(); i != connections.constEnd(); ++i) {
-        connectionRemoved(i.key());
+        slotConnectionRemoved(i.key());
     }
     connections.clear();
 }
diff -r 9f062f9781ab settings_p.h
--- a/settings_p.h Wed Aug 08 11:39:59 2012 +0200
+++ b/settings_p.h Wed Aug 08 11:45:10 2012 +0200
@@ -52,7 +52,7 @@
         OrgFreedesktopNetworkManagerSettingsInterface iface;
     protected Q_SLOTS:
         void slotConnectionAdded(const QDBusObjectPath &);
-        void connectionRemoved(const QString &);
+        void slotConnectionRemoved(const QString &);
         void propertiesChanged(const QVariantMap &);
         void onConnectionAddArrived(QDBusPendingCallWatcher *);
         void daemonUnregistered();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-networkmanager/attachments/20120808/e50bdc35/attachment.html>


More information about the kde-networkmanager mailing list