diff options
author | David Zeuthen <davidz@redhat.com> | 2010-06-09 10:56:35 -0400 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2010-06-09 10:59:02 -0400 |
commit | 1951c39c44afad8273e2978b4c1420e975882934 (patch) | |
tree | 690344e32e0cbbf4d762520d6ba1928aa9d331dd | |
parent | 67193f55c3201e32405c5a15621d49f703b83f8f (diff) |
Bug 621119 – GDBusProxy and objects with no properties
Fix proxy construction for objects with no properties in the case
where G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES isn't set.
The unfortunate side-effect here is that GDBusProxy can no longer be
used to test for "object existence", e.g. creating a GDBusProxy for
any path and interface will not fail. But that's not really a big
deal, if apps rely on that they are doing something very wrong.
https://bugzilla.gnome.org/show_bug.cgi?id=621119
Signed-off-by: David Zeuthen <davidz@redhat.com>
-rw-r--r-- | gio/gdbusproxy.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c index 8be309f0b..b4a64121c 100644 --- a/gio/gdbusproxy.c +++ b/gio/gdbusproxy.c @@ -851,7 +851,22 @@ initable_init (GInitable *initable, cancellable, error); if (result == NULL) - goto out; + { + /* We just ignore if GetAll() is failing. Because this might happen + * if the object has no properties at all. Or if the caller is + * not authorized to see the properties. + * + * Either way, apps can know about this by using + * get_cached_property_names() or get_cached_property(). + * + * TODO: handle G_DBUS_DEBUG flag 'proxy' and, if enabled, log the + * fact that GetAll() failed + */ + //g_debug ("error: %d %d %s", error->domain, error->code, error->message); + g_error_free (error); + ret = TRUE; + goto out; + } process_get_all_reply (proxy, result); @@ -888,7 +903,17 @@ get_all_cb (GDBusConnection *connection, &error); if (result == NULL) { - g_simple_async_result_set_from_error (simple, error); + /* We just ignore if GetAll() is failing. Because this might happen + * if the object has no properties at all. Or if the caller is + * not authorized to see the properties. + * + * Either way, apps can know about this by using + * get_cached_property_names() or get_cached_property(). + * + * TODO: handle G_DBUS_DEBUG flag 'proxy' and, if enabled, log the + * fact that GetAll() failed + */ + //g_debug ("error: %d %d %s", error->domain, error->code, error->message); g_error_free (error); } else @@ -954,16 +979,11 @@ async_initable_init_finish (GAsyncInitable *initable, ret = FALSE; + if (g_simple_async_result_propagate_error (simple, error)) + goto out; + result = g_simple_async_result_get_op_res_gpointer (simple); - if (result == NULL) - { - if (!(proxy->priv->flags & G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES)) - { - g_simple_async_result_propagate_error (simple, error); - goto out; - } - } - else + if (result != NULL) { process_get_all_reply (proxy, result); } |