linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 4/8] gdbus: Fix emitting PropertiesChanged twice
Date: Mon, 19 Aug 2013 17:32:55 +0300	[thread overview]
Message-ID: <1376922779-11802-6-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1376922779-11802-1-git-send-email-luiz.dentz@gmail.com>

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

This fixes double emission of PropertiesChanged introduced by flushing
changes, the flushing can happen during the pending processing so the
pending_prop flag needs to be updated in the beginning and the list of
properties can be freed before g_dbus_send_message as it is not required
anymore.
---
 gdbus/object.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index 92f57a0..ae73061 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -1636,6 +1636,8 @@ static void process_properties_from_interface(struct generic_data *data,
 	DBusMessageIter iter, dict, array;
 	GSList *invalidated;
 
+	data->pending_prop = FALSE;
+
 	if (iface->pending_prop == NULL)
 		return;
 
@@ -1685,10 +1687,10 @@ static void process_properties_from_interface(struct generic_data *data,
 	g_slist_free(invalidated);
 	dbus_message_iter_close_container(&iter, &array);
 
-	g_dbus_send_message(data->conn, signal);
-
 	g_slist_free(iface->pending_prop);
 	iface->pending_prop = NULL;
+
+	g_dbus_send_message(data->conn, signal);
 }
 
 static void process_property_changes(struct generic_data *data)
@@ -1700,8 +1702,6 @@ static void process_property_changes(struct generic_data *data)
 
 		process_properties_from_interface(data, iface);
 	}
-
-	data->pending_prop = FALSE;
 }
 
 void g_dbus_emit_property_changed(DBusConnection *connection,
-- 
1.8.3.1


  parent reply	other threads:[~2013-08-19 14:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-19 14:32 [PATCH BlueZ 0/8] Fix message order Luiz Augusto von Dentz
2013-08-19 14:32 ` [PATCH BlueZ] build: Fix not checking readline.h for bluetooth-player Luiz Augusto von Dentz
2013-08-20 12:28   ` Luiz Augusto von Dentz
2013-08-19 14:32 ` [PATCH BlueZ 1/8] gdbus: Fix not maintaining message order for signals Luiz Augusto von Dentz
2013-08-19 23:59   ` Lucas De Marchi
2013-08-19 14:32 ` [PATCH BlueZ 2/8] gdbus: Add g_dbus_send_message_with_reply Luiz Augusto von Dentz
2013-08-19 14:32 ` [PATCH BlueZ 3/8] gdbus: Avoid calling dbus_connection_send* Luiz Augusto von Dentz
2013-08-19 14:32 ` Luiz Augusto von Dentz [this message]
2013-08-19 14:32 ` [PATCH BlueZ 5/8] core: Make use of g_dbus_send_message_with_reply Luiz Augusto von Dentz
2013-08-19 14:32 ` [PATCH BlueZ 6/8] neard: " Luiz Augusto von Dentz
2013-08-19 14:32 ` [PATCH BlueZ 7/8] audio/media: " Luiz Augusto von Dentz
2013-08-19 14:32 ` [PATCH BlueZ 8/8] obexd: Make use of g_dbus_send_message* Luiz Augusto von Dentz

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=1376922779-11802-6-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;
as well as URLs for NNTP newsgroup(s).