diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-05-27 08:33:45 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-05-27 08:33:45 +0000 |
commit | af6885a49f231d2e5fe421187679b27252658b6c (patch) | |
tree | 521026a0632acb53ce64a0329428db5dab796dd6 /gdbus | |
parent | 0e07fdd871947eea8d082b094494358c49596d0f (diff) |
Fix object path reference count handling
Diffstat (limited to 'gdbus')
-rw-r--r-- | gdbus/object.c | 24 |
1 files changed, 16 insertions, 8 deletions
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); |