summaryrefslogtreecommitdiff
path: root/libnm-glib/nm-object.c
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/nm-object.c
parent411cb363444177369e55e98d613ae35ae7bddd81 (diff)
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/nm-object.c')
-rw-r--r--libnm-glib/nm-object.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c
index 43f5dec71..e333f9f41 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);
}