summaryrefslogtreecommitdiff
path: root/libnm-glib
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2012-04-23 11:02:48 -0400
committerDan Winship <danw@gnome.org>2012-04-23 16:09:58 -0400
commitbe18dd06cd138be232ff68ec7af19cfcf2f969ed (patch)
tree79142d51b6ada6abde403cdb3095d6e4558cad6f /libnm-glib
parent411cb363444177369e55e98d613ae35ae7bddd81 (diff)
downloadNetworkManager-be18dd06cd138be232ff68ec7af19cfcf2f969ed.tar.gz
libnm-glib: NULL out priv fields on dispose()
In some situations, objects might get used after being disposed, so clear out their various priv fields so we don't try to access unreffed objects, freed strings, etc. https://bugzilla.gnome.org/show_bug.cgi?id=674473
Diffstat (limited to 'libnm-glib')
-rw-r--r--libnm-glib/nm-access-point.c10
-rw-r--r--libnm-glib/nm-active-connection.c12
-rw-r--r--libnm-glib/nm-client.c17
-rw-r--r--libnm-glib/nm-device-bond.c5
-rw-r--r--libnm-glib/nm-device-bt.c10
-rw-r--r--libnm-glib/nm-device-ethernet.c11
-rw-r--r--libnm-glib/nm-device-infiniband.c5
-rw-r--r--libnm-glib/nm-device-modem.c11
-rw-r--r--libnm-glib/nm-device-olpc-mesh.c10
-rw-r--r--libnm-glib/nm-device-vlan.c5
-rw-r--r--libnm-glib/nm-device-wifi.c10
-rw-r--r--libnm-glib/nm-device-wimax.c17
-rw-r--r--libnm-glib/nm-device.c28
-rw-r--r--libnm-glib/nm-object.c19
-rw-r--r--libnm-glib/nm-remote-connection.c11
-rw-r--r--libnm-glib/nm-remote-settings.c32
-rw-r--r--libnm-glib/nm-secret-agent.c37
-rw-r--r--libnm-glib/nm-vpn-plugin.c14
-rw-r--r--libnm-glib/nm-wimax-nsp.c10
19 files changed, 88 insertions, 186 deletions
diff --git a/libnm-glib/nm-access-point.c b/libnm-glib/nm-access-point.c
index a6218ed946..9c11c04d98 100644
--- a/libnm-glib/nm-access-point.c
+++ b/libnm-glib/nm-access-point.c
@@ -41,7 +41,6 @@ G_DEFINE_TYPE (NMAccessPoint, nm_access_point, NM_TYPE_OBJECT)
#define NM_ACCESS_POINT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACCESS_POINT, NMAccessPointPrivate))
typedef struct {
- gboolean disposed;
DBusGProxy *proxy;
NM80211ApFlags flags;
@@ -431,14 +430,7 @@ dispose (GObject *object)
{
NMAccessPointPrivate *priv = NM_ACCESS_POINT_GET_PRIVATE (object);
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_access_point_parent_class)->dispose (object);
- return;
- }
-
- priv->disposed = TRUE;
-
- g_object_unref (priv->proxy);
+ g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_access_point_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c
index 81b1f01167..f170121b50 100644
--- a/libnm-glib/nm-active-connection.c
+++ b/libnm-glib/nm-active-connection.c
@@ -49,7 +49,6 @@ G_DEFINE_TYPE_WITH_CODE (NMActiveConnection, nm_active_connection, NM_TYPE_OBJEC
#define NM_ACTIVE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionPrivate))
typedef struct {
- gboolean disposed;
DBusGProxy *proxy;
char *connection;
@@ -357,18 +356,13 @@ dispose (GObject *object)
{
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_active_connection_parent_class)->dispose (object);
- return;
- }
-
- priv->disposed = TRUE;
-
if (priv->devices) {
g_ptr_array_foreach (priv->devices, (GFunc) g_object_unref, NULL);
g_ptr_array_free (priv->devices, TRUE);
+ priv->devices = NULL;
}
- g_object_unref (priv->proxy);
+
+ g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_active_connection_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c
index 781ce4c46e..4a908e0f06 100644
--- a/libnm-glib/nm-client.c
+++ b/libnm-glib/nm-client.c
@@ -53,8 +53,6 @@ G_DEFINE_TYPE_WITH_CODE (NMClient, nm_client, NM_TYPE_OBJECT,
#define NM_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_CLIENT, NMClientPrivate))
typedef struct {
- gboolean disposed;
-
DBusGProxy *client_proxy;
DBusGProxy *bus_proxy;
gboolean manager_running;
@@ -1517,24 +1515,23 @@ dispose (GObject *object)
{
NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (object);
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_client_parent_class)->dispose (object);
- return;
- }
-
- if (priv->perm_call)
+ if (priv->perm_call) {
dbus_g_proxy_cancel_call (priv->client_proxy, priv->perm_call);
+ priv->perm_call = NULL;
+ }
- g_object_unref (priv->client_proxy);
- g_object_unref (priv->bus_proxy);
+ g_clear_object (&priv->client_proxy);
+ g_clear_object (&priv->bus_proxy);
free_object_array (&priv->devices);
dispose_and_free_object_array (&priv->active_connections);
g_slist_foreach (priv->pending_activations, (GFunc) activate_info_free, NULL);
g_slist_free (priv->pending_activations);
+ priv->pending_activations = NULL;
g_hash_table_destroy (priv->permissions);
+ priv->permissions = NULL;
G_OBJECT_CLASS (nm_client_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-device-bond.c b/libnm-glib/nm-device-bond.c
index 7d8bf578fb..07ec4e8ec5 100644
--- a/libnm-glib/nm-device-bond.c
+++ b/libnm-glib/nm-device-bond.c
@@ -215,10 +215,7 @@ dispose (GObject *object)
{
NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (object);
- if (priv->proxy) {
- g_object_unref (priv->proxy);
- priv->proxy = NULL;
- }
+ g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_device_bond_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-device-bt.c b/libnm-glib/nm-device-bt.c
index bd8ccd285e..b175f37d43 100644
--- a/libnm-glib/nm-device-bt.c
+++ b/libnm-glib/nm-device-bt.c
@@ -42,8 +42,6 @@ typedef struct {
char *hw_address;
char *name;
guint32 bt_capabilities;
-
- gboolean disposed;
} NMDeviceBtPrivate;
enum {
@@ -273,13 +271,7 @@ dispose (GObject *object)
{
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (object);
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_device_bt_parent_class)->dispose (object);
- return;
- }
- priv->disposed = TRUE;
-
- g_object_unref (priv->proxy);
+ g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_device_bt_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-device-ethernet.c b/libnm-glib/nm-device-ethernet.c
index 2c35a977bd..bc61b1fed7 100644
--- a/libnm-glib/nm-device-ethernet.c
+++ b/libnm-glib/nm-device-ethernet.c
@@ -44,8 +44,6 @@ typedef struct {
char *perm_hw_address;
guint32 speed;
gboolean carrier;
-
- gboolean disposed;
} NMDeviceEthernetPrivate;
enum {
@@ -280,14 +278,7 @@ dispose (GObject *object)
{
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (object);
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_device_ethernet_parent_class)->dispose (object);
- return;
- }
-
- priv->disposed = TRUE;
-
- g_object_unref (priv->proxy);
+ g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_device_ethernet_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-device-infiniband.c b/libnm-glib/nm-device-infiniband.c
index 4f2882367a..4dee29dafa 100644
--- a/libnm-glib/nm-device-infiniband.c
+++ b/libnm-glib/nm-device-infiniband.c
@@ -224,10 +224,7 @@ dispose (GObject *object)
{
NMDeviceInfinibandPrivate *priv = NM_DEVICE_INFINIBAND_GET_PRIVATE (object);
- if (priv->proxy) {
- g_object_unref (priv->proxy);
- priv->proxy = NULL;
- }
+ g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_device_infiniband_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-device-modem.c b/libnm-glib/nm-device-modem.c
index 09b6df10b5..40597bf3c9 100644
--- a/libnm-glib/nm-device-modem.c
+++ b/libnm-glib/nm-device-modem.c
@@ -44,8 +44,6 @@ typedef struct {
NMDeviceModemCapabilities caps;
NMDeviceModemCapabilities current_caps;
-
- gboolean disposed;
} NMDeviceModemPrivate;
enum {
@@ -225,14 +223,7 @@ dispose (GObject *object)
{
NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (object);
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_device_modem_parent_class)->dispose (object);
- return;
- }
-
- priv->disposed = TRUE;
-
- g_object_unref (priv->proxy);
+ g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_device_modem_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-device-olpc-mesh.c b/libnm-glib/nm-device-olpc-mesh.c
index 96e1c36196..9d14aa0b63 100644
--- a/libnm-glib/nm-device-olpc-mesh.c
+++ b/libnm-glib/nm-device-olpc-mesh.c
@@ -227,14 +227,8 @@ dispose (GObject *object)
{
NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (object);
- if (priv->companion) {
- g_object_unref (priv->companion);
- priv->companion = NULL;
- }
- if (priv->proxy) {
- g_object_unref (priv->proxy);
- priv->proxy = NULL;
- }
+ g_clear_object (&priv->companion);
+ g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_device_olpc_mesh_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-device-vlan.c b/libnm-glib/nm-device-vlan.c
index 7ebc8dd5c9..6ff729276c 100644
--- a/libnm-glib/nm-device-vlan.c
+++ b/libnm-glib/nm-device-vlan.c
@@ -238,10 +238,7 @@ dispose (GObject *object)
{
NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (object);
- if (priv->proxy) {
- g_object_unref (priv->proxy);
- priv->proxy = NULL;
- }
+ g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_device_vlan_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-device-wifi.c b/libnm-glib/nm-device-wifi.c
index aba43f99f9..01f0468c37 100644
--- a/libnm-glib/nm-device-wifi.c
+++ b/libnm-glib/nm-device-wifi.c
@@ -43,7 +43,6 @@ G_DEFINE_TYPE (NMDeviceWifi, nm_device_wifi, NM_TYPE_DEVICE)
void _nm_device_wifi_set_wireless_enabled (NMDeviceWifi *device, gboolean enabled);
typedef struct {
- gboolean disposed;
DBusGProxy *proxy;
char *hw_address;
@@ -608,15 +607,8 @@ dispose (GObject *object)
{
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (object);
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_device_wifi_parent_class)->dispose (object);
- return;
- }
-
- priv->disposed = TRUE;
-
clean_up_aps (NM_DEVICE_WIFI (object), FALSE);
- g_object_unref (priv->proxy);
+ g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_device_wifi_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-device-wimax.c b/libnm-glib/nm-device-wimax.c
index e49b4f31a8..de99b7c16c 100644
--- a/libnm-glib/nm-device-wimax.c
+++ b/libnm-glib/nm-device-wimax.c
@@ -42,7 +42,6 @@ G_DEFINE_TYPE (NMDeviceWimax, nm_device_wimax, NM_TYPE_DEVICE)
void _nm_device_wimax_set_wireless_enabled (NMDeviceWimax *wimax, gboolean enabled);
typedef struct {
- gboolean disposed;
DBusGProxy *proxy;
char *hw_address;
@@ -593,18 +592,18 @@ dispose (GObject *object)
{
NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (object);
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_device_wimax_parent_class)->dispose (object);
- return;
+ if (priv->hw_address) {
+ g_free (priv->hw_address);
+ priv->hw_address = NULL;
}
- priv->disposed = TRUE;
-
- g_free (priv->hw_address);
- g_free (priv->bsid);
+ if (priv->bsid) {
+ g_free (priv->bsid);
+ priv->bsid = NULL;
+ }
clean_up_nsps (NM_DEVICE_WIMAX (object), FALSE);
- g_object_unref (priv->proxy);
+ g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_device_wimax_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c
index a8a63382d3..5346b9d841 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -60,7 +60,6 @@ G_DEFINE_TYPE_WITH_CODE (NMDevice, nm_device, NM_TYPE_OBJECT,
#define NM_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE, NMDevicePrivate))
typedef struct {
- gboolean disposed;
DBusGProxy *proxy;
char *iface;
@@ -265,26 +264,13 @@ dispose (GObject *object)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (object);
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_device_parent_class)->dispose (object);
- return;
- }
-
- priv->disposed = TRUE;
-
- g_object_unref (priv->proxy);
- if (priv->ip4_config)
- g_object_unref (priv->ip4_config);
- if (priv->dhcp4_config)
- g_object_unref (priv->dhcp4_config);
- if (priv->ip6_config)
- g_object_unref (priv->ip6_config);
- if (priv->dhcp6_config)
- g_object_unref (priv->dhcp6_config);
- if (priv->client)
- g_object_unref (priv->client);
- if (priv->active_connection)
- g_object_unref (priv->active_connection);
+ g_clear_object (&priv->proxy);
+ g_clear_object (&priv->ip4_config);
+ g_clear_object (&priv->dhcp4_config);
+ g_clear_object (&priv->ip6_config);
+ g_clear_object (&priv->dhcp6_config);
+ g_clear_object (&priv->client);
+ g_clear_object (&priv->active_connection);
G_OBJECT_CLASS (nm_device_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c
index 43f5dec71e..e333f9f412 100644
--- a/libnm-glib/nm-object.c
+++ b/libnm-glib/nm-object.c
@@ -78,7 +78,7 @@ typedef struct {
GSList *notify_props;
guint32 notify_id;
- gboolean inited, disposed;
+ gboolean inited;
GSList *reload_results;
guint reload_remaining;
@@ -194,13 +194,6 @@ dispose (GObject *object)
{
NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object);
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_object_parent_class)->dispose (object);
- return;
- }
-
- priv->disposed = TRUE;
-
if (priv->notify_id) {
g_source_remove (priv->notify_id);
priv->notify_id = 0;
@@ -208,12 +201,18 @@ dispose (GObject *object)
g_slist_foreach (priv->notify_props, (GFunc) g_free, NULL);
g_slist_free (priv->notify_props);
+ priv->notify_props = NULL;
g_slist_foreach (priv->property_interfaces, (GFunc) g_free, NULL);
g_slist_free (priv->property_interfaces);
+ priv->property_interfaces = NULL;
+
+ g_clear_object (&priv->properties_proxy);
- g_object_unref (priv->properties_proxy);
- dbus_g_connection_unref (priv->connection);
+ if (priv->connection) {
+ dbus_g_connection_unref (priv->connection);
+ priv->connection = NULL;
+ }
G_OBJECT_CLASS (nm_object_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c
index c5e386439d..e8b99dff9c 100644
--- a/libnm-glib/nm-remote-connection.c
+++ b/libnm-glib/nm-remote-connection.c
@@ -72,7 +72,6 @@ typedef struct {
GSList *calls;
gboolean visible;
- gboolean disposed;
} NMRemoteConnectionPrivate;
#define NM_REMOTE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_REMOTE_CONNECTION, NMRemoteConnectionPrivate))
@@ -477,14 +476,14 @@ dispose (GObject *object)
NMRemoteConnection *self = NM_REMOTE_CONNECTION (object);
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (object);
- if (!priv->disposed) {
- priv->disposed = TRUE;
+ while (g_slist_length (priv->calls))
+ remote_call_complete (self, priv->calls->data);
- while (g_slist_length (priv->calls))
- remote_call_complete (self, priv->calls->data);
+ g_clear_object (&priv->proxy);
- g_object_unref (priv->proxy);
+ if (priv->bus) {
dbus_g_connection_unref (priv->bus);
+ priv->bus = NULL;
}
G_OBJECT_CLASS (nm_remote_connection_parent_class)->dispose (object);
diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c
index 040d9126a5..19d865c060 100644
--- a/libnm-glib/nm-remote-settings.c
+++ b/libnm-glib/nm-remote-settings.c
@@ -61,8 +61,6 @@ typedef struct {
DBusGProxy *dbus_proxy;
guint fetch_id;
-
- gboolean disposed;
} NMRemoteSettingsPrivate;
enum {
@@ -1043,29 +1041,35 @@ dispose (GObject *object)
NMRemoteSettings *self = NM_REMOTE_SETTINGS (object);
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self);
- if (priv->disposed)
- return;
-
- priv->disposed = TRUE;
-
- if (priv->fetch_id)
+ if (priv->fetch_id) {
g_source_remove (priv->fetch_id);
+ priv->fetch_id = 0;
+ }
while (g_slist_length (priv->add_list))
add_connection_info_dispose (self, (AddConnectionInfo *) priv->add_list->data);
- if (priv->connections)
+ if (priv->connections) {
g_hash_table_destroy (priv->connections);
+ priv->connections = NULL;
+ }
- if (priv->pending)
+ if (priv->pending) {
g_hash_table_destroy (priv->pending);
+ priv->pending = NULL;
+ }
g_free (priv->hostname);
+ priv->hostname = NULL;
- g_object_unref (priv->dbus_proxy);
- g_object_unref (priv->proxy);
- g_object_unref (priv->props_proxy);
- dbus_g_connection_unref (priv->bus);
+ g_clear_object (&priv->dbus_proxy);
+ g_clear_object (&priv->proxy);
+ g_clear_object (&priv->props_proxy);
+
+ if (priv->bus) {
+ dbus_g_connection_unref (priv->bus);
+ priv->bus = NULL;
+ }
G_OBJECT_CLASS (nm_remote_settings_parent_class)->dispose (object);
}
diff --git a/libnm-glib/nm-secret-agent.c b/libnm-glib/nm-secret-agent.c
index 19f55c0e2d..02f7419b90 100644
--- a/libnm-glib/nm-secret-agent.c
+++ b/libnm-glib/nm-secret-agent.c
@@ -79,8 +79,6 @@ typedef struct {
gboolean auto_register;
gboolean suppress_auto;
gboolean auto_register_id;
-
- gboolean disposed;
} NMSecretAgentPrivate;
enum {
@@ -878,29 +876,28 @@ dispose (GObject *object)
NMSecretAgent *self = NM_SECRET_AGENT (object);
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
- if (!priv->disposed) {
- priv->disposed = TRUE;
-
- if (priv->registered)
- nm_secret_agent_unregister (self);
-
- if (priv->auto_register_id)
- g_source_remove (priv->auto_register_id);
+ if (priv->registered)
+ nm_secret_agent_unregister (self);
- g_free (priv->identifier);
- g_free (priv->nm_owner);
+ if (priv->auto_register_id) {
+ g_source_remove (priv->auto_register_id);
+ priv->auto_register_id = 0;
+ }
- while (priv->pending_gets)
- get_secrets_info_finalize (self, priv->pending_gets->data);
+ g_free (priv->identifier);
+ priv->identifier = NULL;
+ g_free (priv->nm_owner);
+ priv->nm_owner = NULL;
- if (priv->dbus_proxy)
- g_object_unref (priv->dbus_proxy);
+ while (priv->pending_gets)
+ get_secrets_info_finalize (self, priv->pending_gets->data);
- if (priv->manager_proxy)
- g_object_unref (priv->manager_proxy);
+ g_clear_object (&priv->dbus_proxy);
+ g_clear_object (&priv->manager_proxy);
- if (priv->bus)
- dbus_g_connection_unref (priv->bus);
+ if (priv->bus) {
+ dbus_g_connection_unref (priv->bus);
+ priv->bus = NULL;
}
G_OBJECT_CLASS (nm_secret_agent_parent_class)->dispose (object);
diff --git a/libnm-glib/nm-vpn-plugin.c b/libnm-glib/nm-vpn-plugin.c
index 23685384ad..2de3e9fead 100644
--- a/libnm-glib/nm-vpn-plugin.c
+++ b/libnm-glib/nm-vpn-plugin.c
@@ -63,9 +63,6 @@ typedef struct {
DBusGConnection *connection;
char *dbus_service_name;
- /* GObject-y stuff */
- gboolean disposed;
-
/* Temporary stuff */
guint connect_timer;
guint quit_timer;
@@ -590,15 +587,10 @@ dispose (GObject *object)
NMVPNServiceState state;
GError *err = NULL;
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_vpn_plugin_parent_class)->dispose (object);
- return;
- }
-
- priv->disposed = TRUE;
-
- if (priv->fail_stop_id)
+ if (priv->fail_stop_id) {
g_source_remove (priv->fail_stop_id);
+ priv->fail_stop_id = 0;
+ }
state = nm_vpn_plugin_get_state (plugin);
diff --git a/libnm-glib/nm-wimax-nsp.c b/libnm-glib/nm-wimax-nsp.c
index 39553ced19..980f7ced5b 100644
--- a/libnm-glib/nm-wimax-nsp.c
+++ b/libnm-glib/nm-wimax-nsp.c
@@ -37,7 +37,6 @@ G_DEFINE_TYPE (NMWimaxNsp, nm_wimax_nsp, NM_TYPE_OBJECT)
#define NM_WIMAX_NSP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_WIMAX_NSP, NMWimaxNspPrivate))
typedef struct {
- gboolean disposed;
DBusGProxy *proxy;
char *name;
@@ -217,14 +216,7 @@ dispose (GObject *object)
{
NMWimaxNspPrivate *priv = NM_WIMAX_NSP_GET_PRIVATE (object);
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_wimax_nsp_parent_class)->dispose (object);
- return;
- }
-
- priv->disposed = TRUE;
-
- g_object_unref (priv->proxy);
+ g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_wimax_nsp_parent_class)->dispose (object);
}