summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-01-04 09:46:22 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2016-01-06 21:25:55 +0100
commitfbd32869553dd631c486530a2e543c31041af5c2 (patch)
tree9e544a1e2099ecd151d5213eb81ed2e839b33462
parent205ae642f9e45ee911a688356bcba1e5b7646601 (diff)
downloadNetworkManager-fbd32869553dd631c486530a2e543c31041af5c2.tar.gz
core,libnm: use nm_clear_g_source() where possible
Replacement was done with commands: spatch --sp-file nm_clear_g_source.cocci --in-place --smpl-spacing --dir src spatch --sp-file nm_clear_g_source.cocci --in-place --smpl-spacing --dir libnm where nm_clear_g_source.cocci contains: @@ expression e; @@ - if (e) { - g_source_remove (e); - e = 0; - } + nm_clear_g_source (&e);
-rw-r--r--libnm/nm-object.c5
-rw-r--r--src/devices/bluetooth/nm-bluez5-dun.c5
-rw-r--r--src/devices/bluetooth/nm-device-bt.c20
-rw-r--r--src/devices/nm-device-ethernet.c26
-rw-r--r--src/devices/nm-device.c21
-rw-r--r--src/devices/team/nm-device-team.c11
-rw-r--r--src/devices/wifi/nm-device-wifi.c31
-rw-r--r--src/devices/wwan/nm-modem-manager.c10
-rw-r--r--src/dhcp-manager/nm-dhcp-client.c10
-rw-r--r--src/dns-manager/nm-dns-plugin.c5
-rw-r--r--src/dnsmasq-manager/nm-dnsmasq-manager.c5
-rw-r--r--src/nm-connectivity.c5
-rw-r--r--src/nm-manager.c15
-rw-r--r--src/nm-policy.c5
-rw-r--r--src/ppp-manager/nm-ppp-manager.c21
-rw-r--r--src/rdisc/nm-fake-rdisc.c5
-rw-r--r--src/rdisc/nm-lndp-rdisc.c5
-rw-r--r--src/rdisc/nm-rdisc.c10
-rw-r--r--src/settings/nm-settings-connection.c5
-rw-r--r--src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c5
-rw-r--r--src/supplicant-manager/nm-supplicant-manager.c5
-rw-r--r--src/vpn-manager/nm-vpn-connection.c10
22 files changed, 47 insertions, 193 deletions
diff --git a/libnm/nm-object.c b/libnm/nm-object.c
index 5460b83fbc..143931f1b1 100644
--- a/libnm/nm-object.c
+++ b/libnm/nm-object.c
@@ -1748,10 +1748,7 @@ dispose (GObject *object)
{
NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object);
- if (priv->notify_id) {
- g_source_remove (priv->notify_id);
- priv->notify_id = 0;
- }
+ nm_clear_g_source (&priv->notify_id);
g_slist_free_full (priv->notify_items, (GDestroyNotify) notify_item_free);
priv->notify_items = NULL;
diff --git a/src/devices/bluetooth/nm-bluez5-dun.c b/src/devices/bluetooth/nm-bluez5-dun.c
index 9ec6a089fc..875a662fac 100644
--- a/src/devices/bluetooth/nm-bluez5-dun.c
+++ b/src/devices/bluetooth/nm-bluez5-dun.c
@@ -137,10 +137,7 @@ sdp_search_cleanup (NMBluez5DunContext *context)
context->sdp_session = NULL;
}
- if (context->sdp_watch_id) {
- g_source_remove (context->sdp_watch_id);
- context->sdp_watch_id = 0;
- }
+ nm_clear_g_source (&context->sdp_watch_id);
}
static void
diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c
index 75b6a97d27..1e3f9cdc87 100644
--- a/src/devices/bluetooth/nm-device-bt.c
+++ b/src/devices/bluetooth/nm-device-bt.c
@@ -632,10 +632,7 @@ component_added (NMDevice *device, GObject *component)
g_free (base);
/* Got the modem */
- if (priv->timeout_id) {
- g_source_remove (priv->timeout_id);
- priv->timeout_id = 0;
- }
+ nm_clear_g_source (&priv->timeout_id);
/* Can only accept the modem in stage2, but since the interface matched
* what we were expecting, don't let anything else claim the modem either.
@@ -703,10 +700,7 @@ check_connect_continue (NMDeviceBt *self)
dun ? "DUN" : (pan ? "PAN" : "unknown"));
/* Kill the connect timeout since we're connected now */
- if (priv->timeout_id) {
- g_source_remove (priv->timeout_id);
- priv->timeout_id = 0;
- }
+ nm_clear_g_source (&priv->timeout_id);
if (pan) {
/* Bluez says we're connected now. Start IP config. */
@@ -911,10 +905,7 @@ deactivate (NMDevice *device)
if (priv->bt_type != NM_BT_CAPABILITY_NONE)
nm_bluez_device_disconnect (priv->bt_device);
- if (priv->timeout_id) {
- g_source_remove (priv->timeout_id);
- priv->timeout_id = 0;
- }
+ nm_clear_g_source (&priv->timeout_id);
priv->bt_type = NM_BT_CAPABILITY_NONE;
@@ -1104,10 +1095,7 @@ dispose (GObject *object)
{
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (object);
- if (priv->timeout_id) {
- g_source_remove (priv->timeout_id);
- priv->timeout_id = 0;
- }
+ nm_clear_g_source (&priv->timeout_id);
g_signal_handlers_disconnect_matched (priv->bt_device, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object);
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c
index c9fd691cfd..ee516c37ee 100644
--- a/src/devices/nm-device-ethernet.c
+++ b/src/devices/nm-device-ethernet.c
@@ -457,15 +457,8 @@ remove_supplicant_timeouts (NMDeviceEthernet *self)
{
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
- if (priv->supplicant.con_timeout_id) {
- g_source_remove (priv->supplicant.con_timeout_id);
- priv->supplicant.con_timeout_id = 0;
- }
-
- if (priv->supplicant_timeout_id) {
- g_source_remove (priv->supplicant_timeout_id);
- priv->supplicant_timeout_id = 0;
- }
+ nm_clear_g_source (&priv->supplicant.con_timeout_id);
+ nm_clear_g_source (&priv->supplicant_timeout_id);
}
static void
@@ -1030,10 +1023,7 @@ dcb_timeout_cleanup (NMDevice *device)
{
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device);
- if (priv->dcb_timeout_id) {
- g_source_remove (priv->dcb_timeout_id);
- priv->dcb_timeout_id = 0;
- }
+ nm_clear_g_source (&priv->dcb_timeout_id);
}
static void
@@ -1393,10 +1383,7 @@ deactivate (NMDevice *device)
/* Clear wired secrets tries when deactivating */
clear_secrets_tries (device);
- if (priv->pppoe_wait_id) {
- g_source_remove (priv->pppoe_wait_id);
- priv->pppoe_wait_id = 0;
- }
+ nm_clear_g_source (&priv->pppoe_wait_id);
if (priv->pending_ip4_config) {
g_object_unref (priv->pending_ip4_config);
@@ -1635,10 +1622,7 @@ dispose (GObject *object)
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (object);
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
- if (priv->pppoe_wait_id) {
- g_source_remove (priv->pppoe_wait_id);
- priv->pppoe_wait_id = 0;
- }
+ nm_clear_g_source (&priv->pppoe_wait_id);
dcb_timeout_cleanup (NM_DEVICE (self));
dcb_carrier_cleanup (NM_DEVICE (self));
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 8c0a599bc8..b66c07f6a6 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -5149,10 +5149,7 @@ linklocal6_cleanup (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
- if (priv->linklocal6_timeout_id) {
- g_source_remove (priv->linklocal6_timeout_id);
- priv->linklocal6_timeout_id = 0;
- }
+ nm_clear_g_source (&priv->linklocal6_timeout_id);
}
static void
@@ -6471,10 +6468,7 @@ arp_cleanup (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
- if (priv->arp_round2_id) {
- g_source_remove (priv->arp_round2_id);
- priv->arp_round2_id = 0;
- }
+ nm_clear_g_source (&priv->arp_round2_id);
}
static void
@@ -10216,15 +10210,8 @@ dispose (GObject *object)
g_hash_table_remove_all (priv->ip6_saved_properties);
- if (priv->recheck_assume_id) {
- g_source_remove (priv->recheck_assume_id);
- priv->recheck_assume_id = 0;
- }
-
- if (priv->recheck_available.call_id) {
- g_source_remove (priv->recheck_available.call_id);
- priv->recheck_available.call_id = 0;
- }
+ nm_clear_g_source (&priv->recheck_assume_id);
+ nm_clear_g_source (&priv->recheck_available.call_id);
link_disconnect_action_cancel (self);
diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c
index 827a4efad9..c0b83b8442 100644
--- a/src/devices/team/nm-device-team.c
+++ b/src/devices/team/nm-device-team.c
@@ -252,15 +252,8 @@ teamd_cleanup (NMDevice *device, gboolean free_tdc)
{
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (device);
- if (priv->teamd_process_watch) {
- g_source_remove (priv->teamd_process_watch);
- priv->teamd_process_watch = 0;
- }
-
- if (priv->teamd_timeout) {
- g_source_remove (priv->teamd_timeout);
- priv->teamd_timeout = 0;
- }
+ nm_clear_g_source (&priv->teamd_process_watch);
+ nm_clear_g_source (&priv->teamd_timeout);
if (priv->teamd_pid > 0) {
nm_utils_kill_child_async (priv->teamd_pid, SIGTERM, LOGD_TEAM, "teamd", 2000, NULL, NULL);
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index af8880dcfd..55460c8ed8 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -500,10 +500,7 @@ deactivate (NMDevice *device)
int ifindex = nm_device_get_ifindex (device);
NM80211Mode old_mode = priv->mode;
- if (priv->periodic_source_id) {
- g_source_remove (priv->periodic_source_id);
- priv->periodic_source_id = 0;
- }
+ nm_clear_g_source (&priv->periodic_source_id);
cleanup_association_attempt (self, TRUE);
@@ -1428,10 +1425,7 @@ cancel_pending_scan (NMDeviceWifi *self)
{
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
- if (priv->pending_scan_id) {
- g_source_remove (priv->pending_scan_id);
- priv->pending_scan_id = 0;
- }
+ nm_clear_g_source (&priv->pending_scan_id);
}
static void
@@ -1646,15 +1640,8 @@ remove_supplicant_timeouts (NMDeviceWifi *self)
{
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
- if (priv->sup_timeout_id) {
- g_source_remove (priv->sup_timeout_id);
- priv->sup_timeout_id = 0;
- }
-
- if (priv->link_timeout_id) {
- g_source_remove (priv->link_timeout_id);
- priv->link_timeout_id = 0;
- }
+ nm_clear_g_source (&priv->sup_timeout_id);
+ nm_clear_g_source (&priv->link_timeout_id);
}
static void
@@ -2811,10 +2798,7 @@ device_state_changed (NMDevice *device,
if (priv->sup_iface)
supplicant_interface_release (self);
- if (priv->periodic_source_id) {
- g_source_remove (priv->periodic_source_id);
- priv->periodic_source_id = 0;
- }
+ nm_clear_g_source (&priv->periodic_source_id);
cleanup_association_attempt (self, TRUE);
cleanup_supplicant_failures (self);
@@ -2947,10 +2931,7 @@ dispose (GObject *object)
NMDeviceWifi *self = NM_DEVICE_WIFI (object);
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
- if (priv->periodic_source_id) {
- g_source_remove (priv->periodic_source_id);
- priv->periodic_source_id = 0;
- }
+ nm_clear_g_source (&priv->periodic_source_id);
cleanup_association_attempt (self, TRUE);
supplicant_interface_release (self);
diff --git a/src/devices/wwan/nm-modem-manager.c b/src/devices/wwan/nm-modem-manager.c
index e2e5f5cbdd..c28d86adc4 100644
--- a/src/devices/wwan/nm-modem-manager.c
+++ b/src/devices/wwan/nm-modem-manager.c
@@ -194,10 +194,7 @@ modem_manager_name_owner_changed (MMManager *modem_manager,
gchar *name_owner;
/* Quit poking, if any */
- if (self->priv->mm_launch_id) {
- g_source_remove (self->priv->mm_launch_id);
- self->priv->mm_launch_id = 0;
- }
+ nm_clear_g_source (&self->priv->mm_launch_id);
name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (modem_manager));
if (!name_owner) {
@@ -435,10 +432,7 @@ dispose (GObject *object)
{
NMModemManager *self = NM_MODEM_MANAGER (object);
- if (self->priv->mm_launch_id) {
- g_source_remove (self->priv->mm_launch_id);
- self->priv->mm_launch_id = 0;
- }
+ nm_clear_g_source (&self->priv->mm_launch_id);
modem_manager_clear_signals (self);
g_clear_object (&self->priv->modem_manager);
diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c
index 3f37c08b90..59c69c2afc 100644
--- a/src/dhcp-manager/nm-dhcp-client.c
+++ b/src/dhcp-manager/nm-dhcp-client.c
@@ -238,10 +238,7 @@ timeout_cleanup (NMDhcpClient *self)
{
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (self);
- if (priv->timeout_id) {
- g_source_remove (priv->timeout_id);
- priv->timeout_id = 0;
- }
+ nm_clear_g_source (&priv->timeout_id);
}
static void
@@ -249,10 +246,7 @@ watch_cleanup (NMDhcpClient *self)
{
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (self);
- if (priv->watch_id) {
- g_source_remove (priv->watch_id);
- priv->watch_id = 0;
- }
+ nm_clear_g_source (&priv->watch_id);
}
void
diff --git a/src/dns-manager/nm-dns-plugin.c b/src/dns-manager/nm-dns-plugin.c
index 5b3cc69fa4..a82366962f 100644
--- a/src/dns-manager/nm-dns-plugin.c
+++ b/src/dns-manager/nm-dns-plugin.c
@@ -189,10 +189,7 @@ nm_dns_plugin_child_kill (NMDnsPlugin *self)
{
NMDnsPluginPrivate *priv = NM_DNS_PLUGIN_GET_PRIVATE (self);
- if (priv->watch_id) {
- g_source_remove (priv->watch_id);
- priv->watch_id = 0;
- }
+ nm_clear_g_source (&priv->watch_id);
if (priv->pid) {
nm_utils_kill_child_sync (priv->pid, SIGTERM, LOGD_DNS, priv->progname, NULL, 1000, 0);
diff --git a/src/dnsmasq-manager/nm-dnsmasq-manager.c b/src/dnsmasq-manager/nm-dnsmasq-manager.c
index d616085c4d..a17caad389 100644
--- a/src/dnsmasq-manager/nm-dnsmasq-manager.c
+++ b/src/dnsmasq-manager/nm-dnsmasq-manager.c
@@ -385,10 +385,7 @@ nm_dnsmasq_manager_stop (NMDnsMasqManager *manager)
priv = NM_DNSMASQ_MANAGER_GET_PRIVATE (manager);
- if (priv->dm_watch_id) {
- g_source_remove (priv->dm_watch_id);
- priv->dm_watch_id = 0;
- }
+ nm_clear_g_source (&priv->dm_watch_id);
if (priv->pid) {
nm_utils_kill_child_async (priv->pid, SIGTERM, LOGD_SHARING, "dnsmasq", 2000, NULL, NULL);
diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c
index d46e9b49ae..5942c5b77f 100644
--- a/src/nm-connectivity.c
+++ b/src/nm-connectivity.c
@@ -243,10 +243,7 @@ _reschedule_periodic_checks (NMConnectivity *self, gboolean force_reschedule)
priv->initial_check_obsoleted = FALSE;
}
} else {
- if (priv->check_id) {
- g_source_remove (priv->check_id);
- priv->check_id = 0;
- }
+ nm_clear_g_source (&priv->check_id);
}
if (priv->check_id)
return;
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 06027413bf..97cd019808 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -5347,10 +5347,7 @@ dispose (GObject *object)
g_assert (priv->devices == NULL);
- if (priv->ac_cleanup_id) {
- g_source_remove (priv->ac_cleanup_id);
- priv->ac_cleanup_id = 0;
- }
+ nm_clear_g_source (&priv->ac_cleanup_id);
while (priv->active_connections)
active_connection_remove (manager, NM_ACTIVE_CONNECTION (priv->active_connections->data));
@@ -5403,10 +5400,7 @@ dispose (GObject *object)
if (priv->fw_monitor) {
g_signal_handlers_disconnect_by_func (priv->fw_monitor, firmware_dir_changed, manager);
- if (priv->fw_changed_id) {
- g_source_remove (priv->fw_changed_id);
- priv->fw_changed_id = 0;
- }
+ nm_clear_g_source (&priv->fw_changed_id);
g_file_monitor_cancel (priv->fw_monitor);
g_clear_object (&priv->fw_monitor);
@@ -5419,10 +5413,7 @@ dispose (GObject *object)
nm_device_factory_manager_for_each_factory (_deinit_device_factory, manager);
- if (priv->timestamp_update_id) {
- g_source_remove (priv->timestamp_update_id);
- priv->timestamp_update_id = 0;
- }
+ nm_clear_g_source (&priv->timestamp_update_id);
G_OBJECT_CLASS (nm_manager_parent_class)->dispose (object);
}
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 77c2b39342..ba7504cffe 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -1911,10 +1911,7 @@ dispose (GObject *object)
connections = nm_manager_get_active_connections (priv->manager);
g_assert (connections == NULL);
- if (priv->reset_retries_id) {
- g_source_remove (priv->reset_retries_id);
- priv->reset_retries_id = 0;
- }
+ nm_clear_g_source (&priv->reset_retries_id);
g_clear_pointer (&priv->orig_hostname, g_free);
g_clear_pointer (&priv->cur_hostname, g_free);
diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c
index 49f7075347..10bc0fecea 100644
--- a/src/ppp-manager/nm-ppp-manager.c
+++ b/src/ppp-manager/nm-ppp-manager.c
@@ -222,10 +222,7 @@ remove_timeout_handler (NMPPPManager *manager)
{
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
- if (priv->ppp_timeout_handler) {
- g_source_remove (priv->ppp_timeout_handler);
- priv->ppp_timeout_handler = 0;
- }
+ nm_clear_g_source (&priv->ppp_timeout_handler);
}
static void
@@ -1125,10 +1122,7 @@ _ppp_cleanup (NMPPPManager *manager)
cancel_get_secrets (manager);
- if (priv->monitor_id) {
- g_source_remove (priv->monitor_id);
- priv->monitor_id = 0;
- }
+ nm_clear_g_source (&priv->monitor_id);
if (priv->monitor_fd >= 0) {
/* Get the stats one last time */
@@ -1137,15 +1131,8 @@ _ppp_cleanup (NMPPPManager *manager)
priv->monitor_fd = -1;
}
- if (priv->ppp_timeout_handler) {
- g_source_remove (priv->ppp_timeout_handler);
- priv->ppp_timeout_handler = 0;
- }
-
- if (priv->ppp_watch_id) {
- g_source_remove (priv->ppp_watch_id);
- priv->ppp_watch_id = 0;
- }
+ nm_clear_g_source (&priv->ppp_timeout_handler);
+ nm_clear_g_source (&priv->ppp_watch_id);
}
/***********************************************************/
diff --git a/src/rdisc/nm-fake-rdisc.c b/src/rdisc/nm-fake-rdisc.c
index 4d2d034e93..001fd9388e 100644
--- a/src/rdisc/nm-fake-rdisc.c
+++ b/src/rdisc/nm-fake-rdisc.c
@@ -367,10 +367,7 @@ dispose (GObject *object)
{
NMFakeRDiscPrivate *priv = NM_FAKE_RDISC_GET_PRIVATE (object);
- if (priv->receive_ra_id) {
- g_source_remove (priv->receive_ra_id);
- priv->receive_ra_id = 0;
- }
+ nm_clear_g_source (&priv->receive_ra_id);
g_slist_free_full (priv->ras, fake_ra_free);
priv->ras = NULL;
diff --git a/src/rdisc/nm-lndp-rdisc.c b/src/rdisc/nm-lndp-rdisc.c
index d230280f44..46000994ba 100644
--- a/src/rdisc/nm-lndp-rdisc.c
+++ b/src/rdisc/nm-lndp-rdisc.c
@@ -355,10 +355,7 @@ dispose (GObject *object)
NMLNDPRDisc *rdisc = NM_LNDP_RDISC (object);
NMLNDPRDiscPrivate *priv = NM_LNDP_RDISC_GET_PRIVATE (rdisc);
- if (priv->event_id) {
- g_source_remove (priv->event_id);
- priv->event_id = 0;
- }
+ nm_clear_g_source (&priv->event_id);
g_clear_pointer (&priv->event_channel, g_io_channel_unref);
if (priv->ndp) {
diff --git a/src/rdisc/nm-rdisc.c b/src/rdisc/nm-rdisc.c
index 6be8c69da4..6133ae2826 100644
--- a/src/rdisc/nm-rdisc.c
+++ b/src/rdisc/nm-rdisc.c
@@ -623,10 +623,7 @@ check_timestamps (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap changed)
guint32 never = G_MAXINT32;
guint32 nextevent = never;
- if (priv->timeout_id) {
- g_source_remove (priv->timeout_id);
- priv->timeout_id = 0;
- }
+ nm_clear_g_source (&priv->timeout_id);
clean_gateways (rdisc, now, &changed, &nextevent);
clean_addresses (rdisc, now, &changed, &nextevent);
@@ -701,10 +698,7 @@ dispose (GObject *object)
nm_clear_g_source (&priv->send_rs_id);
g_clear_pointer (&priv->last_send_rs_error, g_free);
- if (priv->timeout_id) {
- g_source_remove (priv->timeout_id);
- priv->timeout_id = 0;
- }
+ nm_clear_g_source (&priv->timeout_id);
G_OBJECT_CLASS (nm_rdisc_parent_class)->dispose (object);
}
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index 20f4578da3..f7e5002cd3 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -2616,10 +2616,7 @@ dispose (GObject *object)
}
}
- if (priv->updated_idle_id) {
- g_source_remove (priv->updated_idle_id);
- priv->updated_idle_id = 0;
- }
+ nm_clear_g_source (&priv->updated_idle_id);
/* Disconnect handlers.
* changed_cb() has to be disconnected *before* nm_connection_clear_secrets(),
diff --git a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
index b86d99cd03..484932c9fb 100644
--- a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
+++ b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c
@@ -521,10 +521,7 @@ dispose (GObject *object)
priv->devtimeout_link_changed_handler);
priv->devtimeout_link_changed_handler = 0;
}
- if (priv->devtimeout_timeout_id) {
- g_source_remove (priv->devtimeout_timeout_id);
- priv->devtimeout_timeout_id = 0;
- }
+ nm_clear_g_source (&priv->devtimeout_timeout_id);
g_clear_object (&priv->inotify_helper);
diff --git a/src/supplicant-manager/nm-supplicant-manager.c b/src/supplicant-manager/nm-supplicant-manager.c
index 6d09d6f37b..29c0cd4229 100644
--- a/src/supplicant-manager/nm-supplicant-manager.c
+++ b/src/supplicant-manager/nm-supplicant-manager.c
@@ -345,10 +345,7 @@ dispose (GObject *object)
{
NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (object);
- if (priv->die_count_reset_id) {
- g_source_remove (priv->die_count_reset_id);
- priv->die_count_reset_id = 0;
- }
+ nm_clear_g_source (&priv->die_count_reset_id);
if (priv->cancellable) {
g_cancellable_cancel (priv->cancellable);
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index 6d26b2c108..c548c9fa5e 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -1171,10 +1171,7 @@ nm_vpn_connection_config_maybe_complete (NMVpnConnection *self,
}
}
- if (priv->connect_timeout) {
- g_source_remove (priv->connect_timeout);
- priv->connect_timeout = 0;
- }
+ nm_clear_g_source (&priv->connect_timeout);
if (success) {
print_vpn_config (self);
@@ -2433,10 +2430,7 @@ dispose (GObject *object)
g_clear_pointer (&priv->connect_hash, g_variant_unref);
- if (priv->connect_timeout) {
- g_source_remove (priv->connect_timeout);
- priv->connect_timeout = 0;
- }
+ nm_clear_g_source (&priv->connect_timeout);
dispatcher_cleanup (self);