[PATCH BlueZ 3/3 v2] gdbus: Fix not calling property_changed callback

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

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

In case a property did not appear by the time proxy_added was called
property_changed has to be called if it appear latter otherwise the
application will be unaware of it.
---
 gdbus/client.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/gdbus/client.c b/gdbus/client.c
index 369e3ac..2a7d2e1 100644
--- a/gdbus/client.c
+++ b/gdbus/client.c
@@ -205,6 +205,7 @@ static void prop_entry_free(gpointer data)
 static void add_property(GDBusProxy *proxy, const char *name,
 				DBusMessageIter *iter, gboolean send_changed)
 {
+	GDBusClient *client = proxy->client;
 	DBusMessageIter value;
 	struct prop_entry *prop;
 
@@ -215,20 +216,8 @@ static void add_property(GDBusProxy *proxy, const char *name,
 
 	prop = g_hash_table_lookup(proxy->prop_list, name);
 	if (prop != NULL) {
-		GDBusClient *client = proxy->client;
-
 		prop_entry_update(prop, &value);
-
-		if (proxy->prop_func)
-			proxy->prop_func(proxy, name, &value, proxy->prop_data);
-
-		if (client == NULL || send_changed == FALSE)
-			return;
-
-		if (client->property_changed)
-			client->property_changed(proxy, name, &value,
-							client->user_data);
-		return;
+		goto done;
 	}
 
 	prop = prop_entry_new(name, &value);
@@ -237,8 +226,16 @@ static void add_property(GDBusProxy *proxy, const char *name,
 
 	g_hash_table_replace(proxy->prop_list, prop->name, prop);
 
+done:
 	if (proxy->prop_func)
 		proxy->prop_func(proxy, name, &value, proxy->prop_data);
+
+	if (client == NULL || send_changed == FALSE)
+		return;
+
+	if (client->property_changed)
+		client->property_changed(proxy, name, &value,
+							client->user_data);
 }
 
 static void update_properties(GDBusProxy *proxy, DBusMessageIter *iter,
-- 
1.8.1.2

--
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