From: Johan Hedberg <johan.hedberg@gmail.com>
To: Claudio Takahasi <claudio.takahasi@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ 10/12] Manage GAttrib refs based on registered callbacks
Date: Thu, 14 Jul 2011 20:12:13 +0300 [thread overview]
Message-ID: <20110714171213.GA30789@dell.ger.corp.intel.com> (raw)
In-Reply-To: <1309987448-10183-1-git-send-email-claudio.takahasi@openbossa.org>
Hi Claudio,
On Wed, Jul 06, 2011, Claudio Takahasi wrote:
> Connection should not be dropped if there is at least one ATT connection
> callback registered.
> ---
> src/device.c | 19 ++++++++++++-------
> 1 files changed, 12 insertions(+), 7 deletions(-)
Patches 8 and 9 have now been pushed, but there's some reference
counting weirdness going on here again:
> --- a/src/device.c
> +++ b/src/device.c
> @@ -1664,6 +1664,7 @@ static void primary_cb(GSList *services, guint8 status, gpointer user_data)
> done:
> device->browse = NULL;
> browse_request_free(req, shutdown);
> + g_attrib_unref(device->attrib);
> }
Where's the device->attrib = NULL?
> @@ -2568,18 +2569,22 @@ guint btd_device_add_attio_callback(struct btd_device *device,
> attio->dcfunc = dcfunc;
> attio->user_data = user_data;
>
> - device->attios = g_slist_append(device->attios, attio);
> -
> - if (device->attrib && cfunc)
> - cfunc(device->attrib, user_data);
> + if (device->attrib) {
> + /* First element */
> + if (device->attios == NULL)
> + device->attrib = g_attrib_ref(device->attrib);
Eh? It looks like attio is supposed to own this reference created by
g_attrib_ref() so you should really be assigning the return value to
attio->attrib. Or is it so that device->attrib is actually there only
for any elements in the device->attios list? If that's the case then
it's fine to have just create device->attrib when you add the first
element to the list and unref + set to NULL when you remove the last
element from the list.
Johan
next prev parent reply other threads:[~2011-07-14 17:12 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-05 13:55 [RFC BlueZ 00/12] On demand connection management Claudio Takahasi
2011-07-05 13:55 ` [RFC BlueZ 01/12] Add ATT connection callback registration Claudio Takahasi
2011-07-06 21:22 ` [PATCH " Claudio Takahasi
2011-07-05 13:55 ` [RFC BlueZ 02/12] Add a function to remove ATT connection callback Claudio Takahasi
2011-07-06 21:23 ` [PATCH " Claudio Takahasi
2011-07-05 13:55 ` [RFC BlueZ 03/12] Fix crash when create device is cancelled Claudio Takahasi
2011-07-06 21:23 ` [PATCH " Claudio Takahasi
2011-07-05 13:56 ` [RFC BlueZ 04/12] Notify the GAttrib instance if already connected Claudio Takahasi
2011-07-06 21:23 ` [PATCH " Claudio Takahasi
2011-07-05 13:56 ` [RFC BlueZ 05/12] Add ATT disconnect callback Claudio Takahasi
2011-07-06 21:23 ` [PATCH " Claudio Takahasi
2011-07-05 13:56 ` [RFC BlueZ 06/12] Add auto connection based on registered callbacks Claudio Takahasi
2011-07-06 21:23 ` [PATCH " Claudio Takahasi
2011-07-05 13:56 ` [RFC BlueZ 07/12] Enable ATT re-connection Claudio Takahasi
2011-07-06 21:23 ` [PATCH " Claudio Takahasi
2011-07-05 13:56 ` [RFC BlueZ 08/12] Drop GAttrib ref if callback list is empty Claudio Takahasi
2011-07-06 21:23 ` [PATCH " Claudio Takahasi
2011-07-14 14:44 ` Johan Hedberg
2011-07-14 14:52 ` Anderson Lizardo
2011-07-14 15:17 ` Johan Hedberg
2011-07-14 16:29 ` Claudio Takahasi
2011-07-14 16:36 ` Claudio Takahasi
2011-07-05 13:56 ` [RFC BlueZ 09/12] Try to connect when registering the first callback Claudio Takahasi
2011-07-06 21:24 ` [PATCH " Claudio Takahasi
2011-07-05 13:56 ` [RFC BlueZ 10/12] Manage GAttrib refs based on registered callbacks Claudio Takahasi
2011-07-06 21:24 ` [PATCH " Claudio Takahasi
2011-07-14 17:12 ` Johan Hedberg [this message]
2011-07-20 19:53 ` Claudio Takahasi
2011-07-20 20:24 ` [PATCH BlueZ v2 " Claudio Takahasi
2011-07-05 13:56 ` [RFC BlueZ 11/12] Postpone calling connected callback Claudio Takahasi
2011-07-06 21:24 ` [PATCH " Claudio Takahasi
2011-07-20 20:25 ` [PATCH BlueZ v2 " Claudio Takahasi
2011-07-05 13:56 ` [RFC BlueZ 12/12] Address remote initiated disconnection Claudio Takahasi
2011-07-06 21:24 ` [PATCH " Claudio Takahasi
2011-07-20 20:25 ` [PATCH BlueZ v2 " Claudio Takahasi
2011-07-27 7:43 ` Johan Hedberg
2011-07-06 21:22 ` [PATCH BlueZ 00/12] On demand connection management Claudio Takahasi
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=20110714171213.GA30789@dell.ger.corp.intel.com \
--to=johan.hedberg@gmail.com \
--cc=claudio.takahasi@openbossa.org \
--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).