diff options
author | Thomas Haller <thaller@redhat.com> | 2017-03-13 11:51:33 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-03-13 12:00:23 +0100 |
commit | ec2681d4dbe4f28f5ed08d4c1eef11685e76ebc1 (patch) | |
tree | 4a16300a7b5dcb37411eedd16ee948b850eb3634 | |
parent | e1ea22ca8195bec243c7a65f36be65cbf2061297 (diff) | |
download | NetworkManager-ec2681d4dbe4f28f5ed08d4c1eef11685e76ebc1.tar.gz |
all: use nm_clear_g_cancellable()
-rw-r--r-- | libnm/nm-client.c | 5 | ||||
-rw-r--r-- | libnm/nm-manager.c | 6 | ||||
-rw-r--r-- | src/devices/bluetooth/nm-bluez-manager.c | 5 | ||||
-rw-r--r-- | src/devices/nm-device.c | 10 | ||||
-rw-r--r-- | src/nm-auth-manager.c | 5 | ||||
-rw-r--r-- | src/nm-auth-utils.c | 4 | ||||
-rw-r--r-- | src/nm-policy.c | 11 | ||||
-rw-r--r-- | src/supplicant/nm-supplicant-manager.c | 5 | ||||
-rw-r--r-- | src/vpn/nm-vpn-connection.c | 6 |
9 files changed, 13 insertions, 44 deletions
diff --git a/libnm/nm-client.c b/libnm/nm-client.c index 17c31bf043..ccc96e947e 100644 --- a/libnm/nm-client.c +++ b/libnm/nm-client.c @@ -2525,10 +2525,7 @@ dispose (GObject *object) { NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (object); - if (priv->new_object_manager_cancellable) { - g_cancellable_cancel (priv->new_object_manager_cancellable); - g_clear_object (&priv->new_object_manager_cancellable); - } + nm_clear_g_cancellable (&priv->new_object_manager_cancellable); if (priv->manager) { g_signal_handlers_disconnect_by_data (priv->manager, object); diff --git a/libnm/nm-manager.c b/libnm/nm-manager.c index 5520b580d9..d3df73375b 100644 --- a/libnm/nm-manager.c +++ b/libnm/nm-manager.c @@ -1274,11 +1274,7 @@ dispose (GObject *object) NMManager *manager = NM_MANAGER (object); NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (object); - if (priv->perm_call_cancellable) { - g_cancellable_cancel (priv->perm_call_cancellable); - g_clear_object (&priv->perm_call_cancellable); - } - + nm_clear_g_cancellable (&priv->perm_call_cancellable); if (priv->devices) { g_ptr_array_unref (priv->devices); diff --git a/src/devices/bluetooth/nm-bluez-manager.c b/src/devices/bluetooth/nm-bluez-manager.c index 58fa9b016d..2f0afa1684 100644 --- a/src/devices/bluetooth/nm-bluez-manager.c +++ b/src/devices/bluetooth/nm-bluez-manager.c @@ -134,10 +134,7 @@ cleanup_checking (NMBluezManager *self, gboolean do_unwatch_name) { NMBluezManagerPrivate *priv = NM_BLUEZ_MANAGER_GET_PRIVATE (self); - if (priv->async_cancellable) { - g_cancellable_cancel (priv->async_cancellable); - g_clear_object (&priv->async_cancellable); - } + nm_clear_g_cancellable (&priv->async_cancellable); g_clear_object (&priv->introspect_proxy); diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 9ad016d7d8..51e97a6a87 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -11860,9 +11860,8 @@ deactivate_async_ready (NMDevice *self, if ( g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) || (priv->deactivating_cancellable && g_cancellable_is_cancelled (priv->deactivating_cancellable))) { _LOGW (LOGD_DEVICE, "Deactivation cancelled"); - } - /* In every other case, transition to the DISCONNECTED state */ - else { + } else { + /* In every other case, transition to the DISCONNECTED state */ if (error) { _LOGW (LOGD_DEVICE, "Deactivation failed: %s", error->message); @@ -11890,11 +11889,8 @@ deactivate_dispatcher_complete (guint call_id, gpointer user_data) priv->dispatcher.post_state = NM_DEVICE_STATE_UNKNOWN; priv->dispatcher.post_state_reason = NM_DEVICE_STATE_REASON_NONE; - if (priv->deactivating_cancellable) { + if (nm_clear_g_cancellable (&priv->deactivating_cancellable)) g_warn_if_reached (); - g_cancellable_cancel (priv->deactivating_cancellable); - g_clear_object (&priv->deactivating_cancellable); - } if ( NM_DEVICE_GET_CLASS (self)->deactivate_async && NM_DEVICE_GET_CLASS (self)->deactivate_async_finish) { diff --git a/src/nm-auth-manager.c b/src/nm-auth-manager.c index 4359d8f187..b848e2e35c 100644 --- a/src/nm-auth-manager.c +++ b/src/nm-auth-manager.c @@ -595,10 +595,7 @@ dispose (GObject *object) /* since we take a reference for each queued call, we don't expect to have any queued calls in dispose() */ g_assert (!priv->queued_calls); - if (priv->new_proxy_cancellable) { - g_cancellable_cancel (priv->new_proxy_cancellable); - g_clear_object (&priv->new_proxy_cancellable); - } + nm_clear_g_cancellable (&priv->new_proxy_cancellable); if (priv->proxy) { g_signal_handlers_disconnect_by_data (priv->proxy, self); diff --git a/src/nm-auth-utils.c b/src/nm-auth-utils.c index 930f6d0ff9..f9c958e91f 100644 --- a/src/nm-auth-utils.c +++ b/src/nm-auth-utils.c @@ -301,12 +301,10 @@ auth_call_cancel (gpointer user_data) { AuthCall *call = user_data; - if (call->cancellable) { + if (nm_clear_g_cancellable (&call->cancellable)) { /* we don't free call immediately. Instead we cancel the async operation * and set cancellable to NULL. pk_call_cb() will check for this and * do the final cleanup. */ - g_cancellable_cancel (call->cancellable); - g_clear_object (&call->cancellable); } else { g_source_remove (call->call_idle_id); auth_call_free (call); diff --git a/src/nm-policy.c b/src/nm-policy.c index bc602db72d..a8682d5df6 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -523,10 +523,7 @@ update_system_hostname (NMPolicy *self, NMDevice *best4, NMDevice *best6) g_return_if_fail (self != NULL); - if (priv->lookup_cancellable) { - g_cancellable_cancel (priv->lookup_cancellable); - g_clear_object (&priv->lookup_cancellable); - } + nm_clear_g_cancellable (&priv->lookup_cancellable); /* Hostname precedence order: * @@ -1953,11 +1950,7 @@ dns_config_changed (NMDnsManager *dns_manager, gpointer user_data) * (race in updating DNS and doing the reverse lookup). */ - /* Stop a lookup thread if any. */ - if (priv->lookup_cancellable) { - g_cancellable_cancel (priv->lookup_cancellable); - g_clear_object (&priv->lookup_cancellable); - } + nm_clear_g_cancellable (&priv->lookup_cancellable); /* Re-start the hostname lookup thread if we don't have hostname yet. */ if (priv->lookup_addr) { diff --git a/src/supplicant/nm-supplicant-manager.c b/src/supplicant/nm-supplicant-manager.c index 0a7b4c620d..49650ab714 100644 --- a/src/supplicant/nm-supplicant-manager.c +++ b/src/supplicant/nm-supplicant-manager.c @@ -398,10 +398,7 @@ dispose (GObject *object) nm_clear_g_source (&priv->die_count_reset_id); - if (priv->cancellable) { - g_cancellable_cancel (priv->cancellable); - g_clear_object (&priv->cancellable); - } + nm_clear_g_cancellable (&priv->cancellable); if (priv->ifaces) { for (ifaces = priv->ifaces; ifaces; ifaces = ifaces->next) diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c index 3d4536e702..2120bbe37e 100644 --- a/src/vpn/nm-vpn-connection.c +++ b/src/vpn/nm-vpn-connection.c @@ -2647,10 +2647,8 @@ dispose (GObject *object) cancel_get_secrets (self); - if (priv->cancellable) { - g_cancellable_cancel (priv->cancellable); - g_clear_object (&priv->cancellable); - } + nm_clear_g_cancellable (&priv->cancellable); + g_clear_object (&priv->proxy_config); nm_exported_object_clear_and_unexport (&priv->ip4_config); nm_exported_object_clear_and_unexport (&priv->ip6_config); |