linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] shared/io-glib: Fix not calling destroy callback
@ 2014-11-24 22:35 Szymon Janc
  2014-11-25 11:13 ` Lukasz Rymanowski
  2014-11-26  8:08 ` Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: Szymon Janc @ 2014-11-24 22:35 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

Destroy callback should be called also for G_IO_ERR | G_IO_NVAL
condition.
---
 src/shared/io-glib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/shared/io-glib.c b/src/shared/io-glib.c
index af2ba4e..e9578e1 100644
--- a/src/shared/io-glib.c
+++ b/src/shared/io-glib.c
@@ -159,9 +159,11 @@ static gboolean watch_callback(GIOChannel *channel, GIOCondition cond,
 							gpointer user_data)
 {
 	struct io_watch *watch = user_data;
-	bool result;
+	bool result, destroy;
 
-	if (cond & (G_IO_ERR | G_IO_NVAL))
+	destroy = watch == watch->io->disconnect_watch;
+
+	if (!destroy && (cond & (G_IO_ERR | G_IO_NVAL)))
 		return FALSE;
 
 	if (watch->callback)
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] shared/io-glib: Fix not calling destroy callback
  2014-11-24 22:35 [PATCH] shared/io-glib: Fix not calling destroy callback Szymon Janc
@ 2014-11-25 11:13 ` Lukasz Rymanowski
  2014-11-26  8:08 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Lukasz Rymanowski @ 2014-11-25 11:13 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org

Hi Szymon,

On Mon, Nov 24, 2014 at 11:35 PM, Szymon Janc <szymon.janc@tieto.com> wrote:
> Destroy callback should be called also for G_IO_ERR | G_IO_NVAL
> condition.
> ---
>  src/shared/io-glib.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/shared/io-glib.c b/src/shared/io-glib.c
> index af2ba4e..e9578e1 100644
> --- a/src/shared/io-glib.c
> +++ b/src/shared/io-glib.c
> @@ -159,9 +159,11 @@ static gboolean watch_callback(GIOChannel *channel, GIOCondition cond,
>                                                         gpointer user_data)
>  {
>         struct io_watch *watch = user_data;
> -       bool result;
> +       bool result, destroy;
>
> -       if (cond & (G_IO_ERR | G_IO_NVAL))
> +       destroy = watch == watch->io->disconnect_watch;
> +
> +       if (!destroy && (cond & (G_IO_ERR | G_IO_NVAL)))
>                 return FALSE;
>
Just tested this patch and it works for me.
It also looks good to me.

\Lukasz
>         if (watch->callback)
> --
> 1.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] shared/io-glib: Fix not calling destroy callback
  2014-11-24 22:35 [PATCH] shared/io-glib: Fix not calling destroy callback Szymon Janc
  2014-11-25 11:13 ` Lukasz Rymanowski
@ 2014-11-26  8:08 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2014-11-26  8:08 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth

Hi Szymon,

On Mon, Nov 24, 2014, Szymon Janc wrote:
> Destroy callback should be called also for G_IO_ERR | G_IO_NVAL
> condition.
> ---
>  src/shared/io-glib.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-26  8:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-24 22:35 [PATCH] shared/io-glib: Fix not calling destroy callback Szymon Janc
2014-11-25 11:13 ` Lukasz Rymanowski
2014-11-26  8:08 ` Johan Hedberg

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