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>
This commit is contained in:
David Zeuthen 2010-06-09 10:56:35 -04:00
parent 67193f55c3
commit 1951c39c44

View File

@ -851,7 +851,22 @@ initable_init (GInitable *initable,
cancellable, cancellable,
error); error);
if (result == NULL) if (result == NULL)
{
/* 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; goto out;
}
process_get_all_reply (proxy, result); process_get_all_reply (proxy, result);
@ -888,7 +903,17 @@ get_all_cb (GDBusConnection *connection,
&error); &error);
if (result == NULL) 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); g_error_free (error);
} }
else else
@ -954,16 +979,11 @@ async_initable_init_finish (GAsyncInitable *initable,
ret = FALSE; ret = FALSE;
result = g_simple_async_result_get_op_res_gpointer (simple); if (g_simple_async_result_propagate_error (simple, error))
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; goto out;
}
} result = g_simple_async_result_get_op_res_gpointer (simple);
else if (result != NULL)
{ {
process_get_all_reply (proxy, result); process_get_all_reply (proxy, result);
} }