[kde-plasma-networkmanagement/f14] * Sat Oct 15 2011 Kevin Kofler <Kevin at tigcc.ticalc.org> 1:0.9-0.41.4.20110918git - fix 2 crashes bec

Kevin Kofler kkofler at fedoraproject.org
Sat Oct 15 06:00:36 UTC 2011


commit bc258cf4ee359bd8fbb4ae20b66af1e0bdf1797c
Author: Kevin Kofler <Kevin at tigcc.ticalc.org>
Date:   Sat Oct 15 08:00:28 2011 +0200

    * Sat Oct 15 2011 Kevin Kofler <Kevin at tigcc.ticalc.org> 1:0.9-0.41.4.20110918git
    - fix 2 crashes because of dangling pointers when NM stops (kde#254070)

 ...asma-networkmanagement-nm08-nm-stop-crash.patch |  101 ++++++++++++++++++++
 kde-plasma-networkmanagement.spec                  |   16 +++-
 2 files changed, 116 insertions(+), 1 deletions(-)
---
diff --git a/kde-plasma-networkmanagement-nm08-nm-stop-crash.patch b/kde-plasma-networkmanagement-nm08-nm-stop-crash.patch
new file mode 100644
index 0000000..6cb3212
--- /dev/null
+++ b/kde-plasma-networkmanagement-nm08-nm-stop-crash.patch
@@ -0,0 +1,101 @@
+commit f72e4ecc141c450b139e0afb6adca00672079868
+Author: Lamarque V. Souza <lamarque at gmail.com>
+Date:   Thu Sep 22 15:02:30 2011 -0300
+
+    Prevents two crashes because of dangling pointers when NM stops.
+    
+    BUG: 254070
+
+diff --git a/libs/service/networkinterfaceactivatableprovider.cpp b/libs/service/networkinterfaceactivatableprovider.cpp
+index 23a599e..cb2db35 100644
+--- a/libs/service/networkinterfaceactivatableprovider.cpp
++++ b/libs/service/networkinterfaceactivatableprovider.cpp
+@@ -58,6 +58,26 @@ NetworkInterfaceActivatableProvider::NetworkInterfaceActivatableProvider(Network
+ void NetworkInterfaceActivatableProvider::init()
+ {
+     Q_D(NetworkInterfaceActivatableProvider);
++
++    /* d->interface can be a dangling pointer in one situation:
++     * NMDBusSettingsConnectionProvider::clearConnections() calls the Removed signal for
++     * all connections AFTER NetworkManager has stopped, and consequently, after all
++     * Solid::Control::NetworkManager::NetworkInterface* objects have been invalidated.
++     * The Removed signal triggers the call sequency NMDBusSettingsConnectionProvider::onRemoteConnectionRemoved() ->
++     * NMDBusSettingsConnectionProvider { d->connectionList->removeConnection(con) } ->
++     * ConnectionList { connHandler->handleRemove(connection) }
++     * handleRemove() -> maintainActivatableForUnconfigured() ->
++     * WiredNetworkInterfaceActivatableProvider::needsActivatableForUnconfigured() ->
++     * d->wiredInterface() -> qobject_cast<Solid::Control::WiredNetworkInterfaceNm09*>(interface).
++     * interface is an invalid pointer and crashes the kded module.
++     * Actually Solid::Control::NetworkManagerNm09::notifier()'s networkInterfaceRemoved signal should
++     * triggers the removing of WiredNetworkInterfaceActivatableProvider before
++     * NMDBusSettingsConnectionProvider::clearConnections() is called, but it seems sometimes, and only sometimes,
++     * that does not happen.
++     * I am using the destroyed signal to set the pointer to 0 and prevent the crash.
++     */
++    connect(d->interface, SIGNAL(destroyed(QObject *)), SLOT(_k_destroyed(QObject *)));
++
+     // assess all connections
+     foreach (const QString &uuid, d->connectionList->connections()) {
+         Knm::Connection * connection = d->connectionList->findConnection(uuid);
+@@ -69,6 +89,13 @@ void NetworkInterfaceActivatableProvider::init()
+     maintainActivatableForUnconfigured();
+ }
+ 
++void NetworkInterfaceActivatableProvider::_k_destroyed(QObject *object)
++{
++    Q_D(NetworkInterfaceActivatableProvider);
++    Q_UNUSED(object);
++    d->interface = 0;
++}
++
+ NetworkInterfaceActivatableProvider::~NetworkInterfaceActivatableProvider()
+ {
+     Q_D(NetworkInterfaceActivatableProvider);
+diff --git a/libs/service/networkinterfaceactivatableprovider.h b/libs/service/networkinterfaceactivatableprovider.h
+index c843830..20c91df 100644
+--- a/libs/service/networkinterfaceactivatableprovider.h
++++ b/libs/service/networkinterfaceactivatableprovider.h
+@@ -85,6 +85,10 @@ public:
+      * @reimp ConnectionHandler
+      */
+     virtual void handleRemove(Knm::Connection *);
++
++protected Q_SLOTS:
++    void _k_destroyed(QObject *);
++
+ protected:
+     NetworkInterfaceActivatableProvider(NetworkInterfaceActivatableProviderPrivate& dd, QObject * parent);
+     NetworkInterfaceActivatableProviderPrivate * d_ptr;
+diff --git a/libs/service/wirednetworkinterfaceactivatableprovider.cpp b/libs/service/wirednetworkinterfaceactivatableprovider.cpp
+index d0e2a88..5db4dd7 100644
+--- a/libs/service/wirednetworkinterfaceactivatableprovider.cpp
++++ b/libs/service/wirednetworkinterfaceactivatableprovider.cpp
+@@ -85,7 +85,12 @@ void WiredNetworkInterfaceActivatableProvider::handleCarrierChange(bool carrier)
+ bool WiredNetworkInterfaceActivatableProvider::needsActivatableForUnconfigured() const
+ {
+     Q_D(const WiredNetworkInterfaceActivatableProvider);
+-    return d->activatables.isEmpty() && d->wiredInterface()->carrier();
++    // wiredInterface() can be null if NetworkManager has just stopped and this provider
++    // has not been unregistered yet.
++    if (d->wiredInterface()) {
++        return d->activatables.isEmpty() && d->wiredInterface()->carrier();
++    }
++    return false;
+ }
+ 
+ // vim: sw=4 sts=4 et tw=100
+diff --git a/libs/service/wirelessnetworkinterfaceactivatableprovider.cpp b/libs/service/wirelessnetworkinterfaceactivatableprovider.cpp
+index 004e190..9cc4421 100644
+--- a/libs/service/wirelessnetworkinterfaceactivatableprovider.cpp
++++ b/libs/service/wirelessnetworkinterfaceactivatableprovider.cpp
+@@ -197,7 +197,9 @@ void WirelessNetworkInterfaceActivatableProvider::handleRemove(Knm::Connection *
+     // try to create a WirelessNetwork - this will do nothing if other connections for this network
+     // still exist
+     Knm::WirelessSetting * wirelessSetting = dynamic_cast<Knm::WirelessSetting *>(removedConnection->setting(Knm::Setting::Wireless));
+-    if (wirelessSetting) {
++    // d->interface may be null if NM has just stopped and this provider has not been unregistered yet.
++    // d->environment is a child of d->interface, so it is a valid pointer in that situation.
++    if (wirelessSetting && d->interface) {
+         if (d->environment->networks().contains(wirelessSetting->ssid())) {
+             networkAppeared(wirelessSetting->ssid());
+         }
diff --git a/kde-plasma-networkmanagement.spec b/kde-plasma-networkmanagement.spec
index fc85dbc..bd352bc 100644
--- a/kde-plasma-networkmanagement.spec
+++ b/kde-plasma-networkmanagement.spec
@@ -1,11 +1,18 @@
 
+# Think twice before taking a new snapshot for F14!
+# 1. Translations now track nm09.
+# 2. The master branch will soon host new development, so you'd have to use the
+#    nm08 branch.
+# 3. There have been almost no changes in the nm08 branch.
+# 4. UI change 721952b7 has been reverted in nm09 because the notifications
+#    being disabled there are needed in VPN, but hasn't been reverted in nm08.
 %global snap 20110918
 
 Name:           kde-plasma-networkmanagement
 Epoch:          1
 Version:        0.9
 # Bump this integer: V if you do new builds (upgrade path)
-Release:        0.41.3.%{snap}git%{?dist}
+Release:        0.41.4.%{snap}git%{?dist}
 Summary:        NetworkManager KDE 4 integration
 
 Group:          Applications/Internet
@@ -24,6 +31,9 @@ Source10: 00-fedora-networkmanagement.js
 ## upstreamable patches
 
 ## upstream patches
+# fix 2 crashes because of dangling pointers when NM stops (kde#254070)
+# (upstream patch, by Lamarque Vieira Souza)
+Patch100: kde-plasma-networkmanagement-nm08-nm-stop-crash.patch
 
 BuildRequires:  kdelibs4-devel >= 4.5.0
 BuildRequires:  kdebase-workspace-devel
@@ -100,6 +110,7 @@ Provides:       knetworkmanager-vpnc = %{?epoch:%{epoch}:}%{version}-%{release}
 
 %prep
 %setup -q -n networkmanagement-%{version}
+%patch100 -p1 -b .nm-stop-crash
 
 # nuke monolithic knm bits
 rm -rfv monolithic po/*/knetworkmanager.po
@@ -214,6 +225,9 @@ gtk-update-icon-cache %{_kde4_iconsdir}/oxygen &> /dev/null || :
 
 
 %changelog
+* Sat Oct 15 2011 Kevin Kofler <Kevin at tigcc.ticalc.org> 1:0.9-0.41.4.20110918git
+- fix 2 crashes because of dangling pointers when NM stops (kde#254070)
+
 * Sun Sep 18 2011 Kevin Kofler <Kevin at tigcc.ticalc.org> 1:0.9-0.41.3.20110918git
 - 20110918 snapshot (from git master), mainly for #605527 (wired PPPoE)
 


More information about the scm-commits mailing list