From: Dan Williams Date: Mon, 21 Mar 2016 21:09:30 +0000 (-0500) Subject: core: don't emit double PropertiesChanged signal for new active connections X-Git-Url: https://iam.tj/gitweb/gitweb.cgi?p=NetworkManager.git;a=commitdiff_plain;h=f2182fbf9b2423bd8509b2f0cf218edd96dac32c core: don't emit double PropertiesChanged signal for new active connections When porting to GDBus property change notifications were converted from a hash table to a GVariantBuilder. GVariantBuilder doesn't care about duplicated properties in the dict so each g_object_notify() will add an additional item with possibly different values: signal time=1458571005.592811 sender=:1.10 -> destination=(null destination) serial=64451 path=/org/freedesktop/NetworkManager; interface=org.freedesktop.NetworkManager; member=PropertiesChanged array [ dict entry( string "ActiveConnections" variant array [ object path "/org/freedesktop/NetworkManager/ActiveConnection/19" object path "/org/freedesktop/NetworkManager/ActiveConnection/18" object path "/org/freedesktop/NetworkManager/ActiveConnection/15" object path "/org/freedesktop/NetworkManager/ActiveConnection/0" ] ) dict entry( string "ActiveConnections" variant array [ object path "/org/freedesktop/NetworkManager/ActiveConnection/24" object path "/org/freedesktop/NetworkManager/ActiveConnection/19" object path "/org/freedesktop/NetworkManager/ActiveConnection/18" object path "/org/freedesktop/NetworkManager/ActiveConnection/15" object path "/org/freedesktop/NetworkManager/ActiveConnection/0" ] ) ] Fix that by not emitting notify events for the manager's ActiveConnections property until the property has actually been updated in active_connection_add(). The unexport also isn't required for VPN connections since it will get unexported when it's disposed after _internal_activation_failed() gets called. --- diff --git a/src/nm-manager.c b/src/nm-manager.c index dc394a490..8b978647b 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -2716,19 +2716,12 @@ autoconnect_slaves (NMManager *self, static gboolean _internal_activate_vpn (NMManager *self, NMActiveConnection *active, GError **error) { - gboolean success; - g_assert (NM_IS_VPN_CONNECTION (active)); nm_exported_object_export (NM_EXPORTED_OBJECT (active)); - success = nm_vpn_manager_activate_connection (NM_MANAGER_GET_PRIVATE (self)->vpn_manager, - NM_VPN_CONNECTION (active), - error); - if (success) - g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVE_CONNECTIONS); - else - nm_exported_object_unexport (NM_EXPORTED_OBJECT (active)); - return success; + return nm_vpn_manager_activate_connection (NM_MANAGER_GET_PRIVATE (self)->vpn_manager, + NM_VPN_CONNECTION (active), + error); } /* Traverse the device to disconnected state. This means that the device is ready @@ -2951,7 +2944,6 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError * /* Export the new ActiveConnection to clients and start it on the device */ nm_exported_object_export (NM_EXPORTED_OBJECT (active)); - g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVE_CONNECTIONS); nm_device_queue_activation (device, NM_ACT_REQUEST (active)); return TRUE; }