about summary refs log tree commit diff
path: root/libnm-glib/nm-object.c
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd@luon.net>2013-10-25 21:20:58 +0200
committerSjoerd Simons <sjoerd@luon.net>2013-10-25 21:20:58 +0200
commita4256940da049f91bbbea5e53e469a59ea9c10f7 (patch)
tree2211c102aea3a33f34f960f48c8b8a55daccd97b /libnm-glib/nm-object.c
parent8d275584fc94f398f0a7c990dcd057533d9a5856 (diff)
Imported Upstream version 0.9.8.8 upstream/0.9.8.8
Diffstat (limited to 'libnm-glib/nm-object.c')
-rw-r--r--libnm-glib/nm-object.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c
index af659bd1..7696673b 100644
--- a/libnm-glib/nm-object.c
+++ b/libnm-glib/nm-object.c
@@ -525,6 +525,17 @@ create_async_complete (GObject *object, NMObjectTypeAsyncData *async_data)
 	g_slice_free (NMObjectTypeAsyncData, async_data);
 }
 
+static const char *
+nm_object_or_connection_get_path (gpointer instance)
+{
+	if (NM_IS_OBJECT (instance))
+		return nm_object_get_path (instance);
+	else if (NM_IS_CONNECTION (instance))
+		return nm_connection_get_path (instance);
+
+	g_assert_not_reached ();
+}
+
 static void
 async_inited (GObject *source, GAsyncResult *result, gpointer user_data)
 {
@@ -534,7 +545,7 @@ async_inited (GObject *source, GAsyncResult *result, gpointer user_data)
 
 	if (!g_async_initable_init_finish (G_ASYNC_INITABLE (object), result, &error)) {
 		g_warning ("Could not create object for %s: %s",
-		           nm_object_get_path (NM_OBJECT (object)), error->message);
+		           nm_object_or_connection_get_path (object), error->message);
 		g_error_free (error);
 		g_object_unref (object);
 		object = NULL;
@@ -634,8 +645,10 @@ add_to_object_array_unique (GPtrArray *array, GObject *obj)
 
 	if (obj != NULL) {
 		for (i = 0; i < array->len; i++) {
-			if (g_ptr_array_index (array, i) == obj)
+			if (g_ptr_array_index (array, i) == obj) {
+				g_object_unref (obj);
 				return;
+			}
 		}
 		g_ptr_array_add (array, obj);
 	}
@@ -1399,6 +1412,7 @@ _nm_object_reload_properties_async (NMObject *object, GAsyncReadyCallback callba
 
 	if (!priv->property_interfaces && !priv->pseudo_properties) {
 		g_simple_async_result_complete_in_idle (simple);
+		g_object_unref (simple);
 		return;
 	}