all: use nm_clear_g_cancellable()

This commit is contained in:
Thomas Haller 2017-03-13 11:51:33 +01:00
parent e1ea22ca81
commit ec2681d4db
9 changed files with 13 additions and 44 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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) {

View file

@ -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);

View file

@ -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);

View file

@ -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) {

View file

@ -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)

View file

@ -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);