[SCM] networkmanager-qt packaging branch, master, updated. debian/5.28.0-1-6-gcd3dbe6

Maximiliano Curia maxy at moszumanska.debian.org
Sat Apr 8 08:47:18 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/frameworks/networkmanager-qt.git;a=commitdiff;h=b4b6780

The following commit has been merged in the master branch:
commit b4b678084029c00b88aedee422af50051eef27d7
Author: Maximiliano Curia <maxy at gnuservers.com.ar>
Date:   Fri Apr 7 19:18:28 2017 +0200

    Pick "Manager: Fix emitting deviceAdded twice when NM restarts" (a183e1f)
    
    Add upstream patch as:
     Manager-Fix-emitting-deviceAdded-twice-when-NM-restarts.patch
    
    Gbp-Dch: Full
---
 ...itting-deviceAdded-twice-when-NM-restarts.patch | 134 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 2 files changed, 135 insertions(+)

diff --git a/debian/patches/Manager-Fix-emitting-deviceAdded-twice-when-NM-restarts.patch b/debian/patches/Manager-Fix-emitting-deviceAdded-twice-when-NM-restarts.patch
new file mode 100644
index 0000000..6d763a1
--- /dev/null
+++ b/debian/patches/Manager-Fix-emitting-deviceAdded-twice-when-NM-restarts.patch
@@ -0,0 +1,134 @@
+From: David Rosca <nowrep at gmail.com>
+Date: Fri, 17 Feb 2017 12:34:58 +0100
+Subject: Manager: Fix emitting deviceAdded twice when NM restarts
+
+Differential Revision: https://phabricator.kde.org/D4646
+---
+ autotests/managertest.cpp       | 20 ++++++++++++++++++++
+ src/fakenetwork/fakenetwork.cpp | 38 ++++++++++++++++++++++++++------------
+ src/fakenetwork/fakenetwork.h   |  2 ++
+ src/manager.cpp                 |  2 +-
+ 4 files changed, 49 insertions(+), 13 deletions(-)
+
+diff --git a/autotests/managertest.cpp b/autotests/managertest.cpp
+index 6cc2429..0759a77 100644
+--- a/autotests/managertest.cpp
++++ b/autotests/managertest.cpp
+@@ -68,6 +68,26 @@ void ManagerTest::testDevices()
+     QVERIFY(NetworkManager::networkInterfaces().isEmpty());
+     QCOMPARE(removeDeviceSpy.at(0).at(0).toString(), addedDevicePath);
+ 
++    addDeviceSpy.clear();
++
++    fakeNetwork->addDevice(device);
++    QVERIFY(addDeviceSpy.wait());
++    QCOMPARE(NetworkManager::networkInterfaces().count(), 1);
++    QCOMPARE(NetworkManager::networkInterfaces().first()->uni(), addDeviceSpy.at(0).at(0).toString());
++
++    addDeviceSpy.clear();
++    removeDeviceSpy.clear();
++
++    fakeNetwork->unregisterService();
++    QTRY_COMPARE(removeDeviceSpy.count(), 1);
++
++    fakeNetwork->registerService();
++    QTRY_COMPARE(addDeviceSpy.count(), 1);
++
++    // Make sure deviceAdded is emitted only once
++    addDeviceSpy.wait(100);
++    QCOMPARE(addDeviceSpy.count(), 1);
++
+     delete device;
+ }
+ 
+diff --git a/src/fakenetwork/fakenetwork.cpp b/src/fakenetwork/fakenetwork.cpp
+index c7a29fd..72cf479 100644
+--- a/src/fakenetwork/fakenetwork.cpp
++++ b/src/fakenetwork/fakenetwork.cpp
+@@ -46,26 +46,16 @@ FakeNetwork::FakeNetwork(QObject *parent)
+     , m_deviceCounter(0)
+     , m_settings(new Settings(this))
+ {
+-    QDBusConnection::sessionBus().registerService(QLatin1Literal("org.kde.fakenetwork"));
+-    QDBusConnection::sessionBus().registerObject(QLatin1Literal("/org/kde/fakenetwork"), this, QDBusConnection::ExportScriptableContents);
+-    QDBusConnection::sessionBus().registerObject(QLatin1Literal("/org/kde/fakenetwork/Settings"), m_settings, QDBusConnection::ExportScriptableContents);
+-
++    registerService();
+     connect(m_settings, &Settings::connectionAdded, this, &FakeNetwork::onConnectionAdded);
+     connect(m_settings, &Settings::connectionRemoved, this, &FakeNetwork::onConnectionRemoved);
+ }
+ 
+ FakeNetwork::~FakeNetwork()
+ {
+-    Q_FOREACH (const QDBusObjectPath & devicePath, m_devices.keys()) {
+-        QDBusConnection::sessionBus().unregisterObject(devicePath.path());
+-        Q_EMIT DeviceRemoved(devicePath);
+-    }
++    unregisterService();
+     qDeleteAll(m_devices);
+-
+     delete m_settings;
+-    QDBusConnection::sessionBus().unregisterObject(QLatin1Literal("/org/kde/fakenetwork/Settings"));
+-    QDBusConnection::sessionBus().unregisterObject(QLatin1Literal("/org/kde/fakenetwork"));
+-    QDBusConnection::sessionBus().unregisterService(QLatin1Literal("org.kde.fakenetwork"));
+ }
+ 
+ QDBusObjectPath FakeNetwork::activatingConnection() const
+@@ -199,6 +189,30 @@ void FakeNetwork::removeDevice(Device *device)
+     Q_EMIT DeviceRemoved(QDBusObjectPath(device->devicePath()));
+ }
+ 
++void FakeNetwork::registerService()
++{
++    QDBusConnection::sessionBus().registerService(QLatin1Literal("org.kde.fakenetwork"));
++    QDBusConnection::sessionBus().registerObject(QLatin1Literal("/org/kde/fakenetwork"), this, QDBusConnection::ExportScriptableContents);
++    QDBusConnection::sessionBus().registerObject(QLatin1Literal("/org/kde/fakenetwork/Settings"), m_settings, QDBusConnection::ExportScriptableContents);
++
++    Q_FOREACH (const QDBusObjectPath & devicePath, m_devices.keys()) {
++        QDBusConnection::sessionBus().registerObject(devicePath.path(), m_devices.value(devicePath), QDBusConnection::ExportScriptableContents);
++        Q_EMIT DeviceAdded(devicePath);
++    }
++}
++
++void FakeNetwork::unregisterService()
++{
++    Q_FOREACH (const QDBusObjectPath & devicePath, m_devices.keys()) {
++        QDBusConnection::sessionBus().unregisterObject(devicePath.path());
++        Q_EMIT DeviceRemoved(devicePath);
++    }
++
++    QDBusConnection::sessionBus().unregisterObject(QLatin1Literal("/org/kde/fakenetwork/Settings"));
++    QDBusConnection::sessionBus().unregisterObject(QLatin1Literal("/org/kde/fakenetwork"));
++    QDBusConnection::sessionBus().unregisterService(QLatin1Literal("org.kde.fakenetwork"));
++}
++
+ QDBusObjectPath FakeNetwork::ActivateConnection(const QDBusObjectPath &connection, const QDBusObjectPath &device, const QDBusObjectPath &specific_object)
+ {
+     ActiveConnection *newActiveConnection = new ActiveConnection(this);
+diff --git a/src/fakenetwork/fakenetwork.h b/src/fakenetwork/fakenetwork.h
+index 64077a9..2ade01e 100644
+--- a/src/fakenetwork/fakenetwork.h
++++ b/src/fakenetwork/fakenetwork.h
+@@ -80,6 +80,8 @@ public:
+     /* Not part of DBus interface */
+     void addDevice(Device *device);
+     void removeDevice(Device *device);
++    void registerService();
++    void unregisterService();
+ 
+ private Q_SLOTS:
+     void onConnectionAdded(const QDBusObjectPath &connection);
+diff --git a/src/manager.cpp b/src/manager.cpp
+index c523e13..2b16e9d 100644
+--- a/src/manager.cpp
++++ b/src/manager.cpp
+@@ -680,8 +680,8 @@ void NetworkManager::NetworkManagerPrivate::onDeviceAdded(const QDBusObjectPath
+     // qCDebug(NMQT);
+     if (!networkInterfaceMap.contains(objpath.path())) {
+         networkInterfaceMap.insert(objpath.path(), Device::Ptr());
++        Q_EMIT deviceAdded(objpath.path());
+     }
+-    Q_EMIT deviceAdded(objpath.path());
+ }
+ 
+ void NetworkManager::NetworkManagerPrivate::onDeviceRemoved(const QDBusObjectPath &objpath)
diff --git a/debian/patches/series b/debian/patches/series
index 2364c3e..df44a0f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 Don-t-force-logging-with-setFilterRules.patch
 Initialise-a-member-variable.patch
 CMake-Use-SYSTEM-for-nm-glib-nm-util-includes.patch
+Manager-Fix-emitting-deviceAdded-twice-when-NM-restarts.patch

-- 
networkmanager-qt packaging



More information about the pkg-kde-commits mailing list