linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Claudio Takahasi <claudio.takahasi@openbossa.org>
Cc: Santiago Carot <sancane@gmail.com>,
	BlueZ development <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH BlueZ 1/6] Proximity Monitor: Write Alert Level to Reporter
Date: Thu, 28 Jul 2011 16:12:35 +0300	[thread overview]
Message-ID: <20110728131235.GA18585@dell.ger.corp.intel.com> (raw)
In-Reply-To: <CAKT1EBdLfwYmHQY_i4DV+aS6U_yCsKHhAv+LpojLTRpXtoNKZw@mail.gmail.com>

Hi Claudio,

On Thu, Jul 28, 2011, Claudio Takahasi wrote:
> On Thu, Jul 28, 2011 at 1:36 AM, Santiago Carot <sancane@gmail.com> wrote:
> >> --- a/proximity/monitor.c
> >> +++ b/proximity/monitor.c
> >> @@ -35,19 +35,28 @@
> >>  #include <sys/stat.h>
> <snip>
> >> +static void attio_connected_cb(GAttrib *attrib, gpointer user_data)
> >> +{
> >> +       struct monitor *monitor = user_data;
> >> +
> >> +       monitor->attrib = attrib;
> >
> > GAttrib is a referenciable structure. Don't you increment the
> > reference counter if you are storing an internal reference in monitor?
> 
> References are controlled by the core. The last reference for the
> GAttrib will not be release by the core until the last connection
> callback is unregistered. This is the reason why reference control
> inside the profiles are not needed. If it is more clear to everybody
> we can add reference counting in the profiles, but it will be a
> duplicated logic. Every btd_device_remove_attio_callback call will be
> followed by g_attrib_unref.

The general rule should be that you never copy a reference counted
pointer without the use of ref(). So in this case I do think it'd be
better to ref() when you copy (from attrib to monitor->attrib) and
unref() before you set to NULL.

Johan

  reply	other threads:[~2011-07-28 13:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27 21:53 [PATCH BlueZ 0/6] Proximity configs and LinkLoss alert write Claudio Takahasi
2011-07-27 21:53 ` [PATCH BlueZ 1/6] Proximity Monitor: Write Alert Level to Reporter Claudio Takahasi
2011-07-28  4:40   ` Santiago Carot
     [not found]   ` <CACLukz+g-994zKLK1aPkBusEhv=ti850KhMSjGZQjJOdL9kdcw@mail.gmail.com>
2011-07-28 13:05     ` Claudio Takahasi
2011-07-28 13:12       ` Johan Hedberg [this message]
2011-07-28 14:43         ` [PATCH BlueZ v2 " Claudio Takahasi
2011-07-27 21:53 ` [PATCH BlueZ 2/6] Add Tx Power and Immediate Alert UUID Claudio Takahasi
2011-07-28 14:43   ` [PATCH BlueZ v2 " Claudio Takahasi
2011-07-27 21:53 ` [PATCH BlueZ 3/6] Add config file for proximity monitor Claudio Takahasi
2011-07-28 14:43   ` [PATCH BlueZ v2 " Claudio Takahasi
2011-07-27 21:53 ` [PATCH BlueZ 4/6] Match probed UUIDs and enabled services Claudio Takahasi
2011-07-28 14:43   ` [PATCH BlueZ v2 " Claudio Takahasi
2011-07-27 21:53 ` [PATCH BlueZ 5/6] Return an error if LinkLoss is disabled Claudio Takahasi
2011-07-28 14:43   ` [PATCH BlueZ v2 " Claudio Takahasi
2011-07-27 21:53 ` [PATCH BlueZ 6/6] Return LinkLossAlertLevel if enabled Claudio Takahasi
2011-07-28 14:43   ` [PATCH BlueZ v2 " Claudio Takahasi
2011-07-28 14:42 ` [PATCH BlueZ v2 0/6] Proximity configs and LinkLoss alert write Claudio Takahasi
2011-08-03  9:38   ` 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=20110728131235.GA18585@dell.ger.corp.intel.com \
    --to=johan.hedberg@gmail.com \
    --cc=claudio.takahasi@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=sancane@gmail.com \
    /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).