From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/3 v3] gdbus: Fix not calling property_changed callback
Date: Wed, 27 Feb 2013 14:00:23 +0200 [thread overview]
Message-ID: <1361966423-3582-3-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1361966423-3582-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
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
next prev parent reply other threads:[~2013-02-27 12:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-27 12:00 [PATCH BlueZ 1/3 v3] unit: Add gdbus/client_set_string_property Luiz Augusto von Dentz
2013-02-27 12:00 ` [PATCH BlueZ 2/3 v3] unit: Add gdbus/client_string_changed Luiz Augusto von Dentz
2013-02-27 12:00 ` Luiz Augusto von Dentz [this message]
2013-02-28 13:04 ` [PATCH BlueZ 1/3 v3] unit: Add gdbus/client_set_string_property Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1361966423-3582-3-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox