RE: Can we change org.openobex.Client's dbus node path?

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

 



>
>this is a bug in gdbus then. The exactly same code is used in
>bluetoothd and connmand so it seems weird. Did you try to debug it
>where it actually fails to get this wrong? Are we missing some
>"invalidate parent" calls?
>
>Regards
>
>Marcel

Hi Marcel

	I found the reason. During interface register object_path_unref did call invalidate_parent_data. But for our case: we have path "/" at first, and we register interface at "/org/openobex/Session0", there are no data for "/org/openobex", so no any parent introspect data is invalidated. But the whole /org/openobex path is created for the first time. So actually the "/"'s introspect data need to be invalidated.

I modify the code as below to invalidate the parent data up to "/", so that it will fix this problem.

-------------------------------------------------------------------
diff --git a/gdbus/object.c b/gdbus/object.c
old mode 100644
new mode 100755
index a417ab9..074f40b
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -299,25 +299,28 @@ static void invalidate_parent_data(DBusConnection *conn, const char *child_path)
        char *parent_path, *slash;

        parent_path = g_strdup(child_path);
-       slash = strrchr(parent_path, '/');
-       if (!slash)
-               goto done;
-
-       *slash = '\0';
-       if (!strlen(parent_path))
-               goto done;
+       do{
+               slash = strrchr(parent_path, '/');
+               if (!slash)
+                       break;

-       if (!dbus_connection_get_object_path_data(conn, parent_path,
-                                                       (void *) &data))
-               goto done;
+               if (slash == parent_path) {
+                       *(slash+1) = '\0';
+               } else {
+                       *slash = '\0';
+               }

-       if (!data)
-               goto done;
+               if (!dbus_connection_get_object_path_data(conn, parent_path,
+                                                               (void *) &data))
+                       continue;

-       g_free(data->introspect);
-       data->introspect = NULL;
+               if (!data)
+                       continue;

-done:
+               g_free(data->introspect);
+               data->introspect = NULL;
+       }while(slash != parent_path);
+
        g_free(parent_path);
 }

-------------------------------------------------------------------------

However, It got some drawback here: if part of the parent path did exist before, and the parent's parents data do not need to change. This fix will do much more thing then it should. I guess to found out all the change up to the necessay level will need more code. So I just make it simple here.

Raymond

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux