From af6885a49f231d2e5fe421187679b27252658b6c Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 27 May 2008 08:33:45 +0000 Subject: Fix object path reference count handling --- gdbus/object.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'gdbus') diff --git a/gdbus/object.c b/gdbus/object.c index 56d17c93..24da21c9 100644 --- a/gdbus/object.c +++ b/gdbus/object.c @@ -361,12 +361,14 @@ done: static struct generic_data *object_path_ref(DBusConnection *connection, const char *path) { - struct generic_data *data = NULL; + struct generic_data *data; if (dbus_connection_get_object_path_data(connection, path, - (void *) &data) || !data) { - data->refcount++; - return data; + (void *) &data) == TRUE) { + if (data != NULL) { + data->refcount++; + return data; + } } data = g_new0(struct generic_data, 1); @@ -391,8 +393,11 @@ static void object_path_unref(DBusConnection *connection, const char *path) { struct generic_data *data = NULL; - if (!dbus_connection_get_object_path_data(connection, path, - (void *) &data) || !data) + if (dbus_connection_get_object_path_data(connection, path, + (void *) &data) == FALSE) + return; + + if (data == NULL) return; data->refcount--; @@ -784,8 +789,11 @@ gboolean g_dbus_unregister_interface(DBusConnection *connection, struct generic_data *data = NULL; struct interface_data *iface; - if (!dbus_connection_get_object_path_data(connection, path, - (void *) &data) || !data) + if (dbus_connection_get_object_path_data(connection, path, + (void *) &data) == FALSE) + return FALSE; + + if (data == NULL) return FALSE; iface = find_interface(data->interfaces, name); -- cgit