[glib] Bug 621119 – GDBusProxy and objects with no properties



commit 1951c39c44afad8273e2978b4c1420e975882934
Author: David Zeuthen <davidz redhat com>
Date:   Wed Jun 9 10:56:35 2010 -0400

    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>

 gio/gdbusproxy.c |   42 +++++++++++++++++++++++++++++++-----------
 1 files changed, 31 insertions(+), 11 deletions(-)
---
diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c
index 8be309f..b4a6412 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);
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]