Re: [PATCH BlueZ 2/2] shared/gatt-client: Reset callbacks when unregistering

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, Feb 9, 2018 at 8:53 AM, Luiz Augusto von Dentz
<luiz.dentz@xxxxxxxxx> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
>
> If user application is unregistering a notification handler its
> callbacks shall not be called even CCC write is still holding a
> reference to notify_data.
> ---
>  src/shared/gatt-client.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
> index 8083ff719..1285c37ef 100644
> --- a/src/shared/gatt-client.c
> +++ b/src/shared/gatt-client.c
> @@ -1212,7 +1212,9 @@ static void complete_notify_request(void *data)
>         struct notify_data *notify_data = data;
>
>         notify_data->att_id = 0;
> -       notify_data->callback(0, notify_data->user_data);
> +
> +       if (notify_data->callback)
> +               notify_data->callback(0, notify_data->user_data);
>  }
>
>  static bool notify_data_write_ccc(struct notify_data *notify_data, bool enable,
> @@ -3157,6 +3159,10 @@ bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client,
>         /* Remove data if it has been queued */
>         queue_remove(notify_data->chrc->reg_notify_queue, notify_data);
>
> +       /* Reset callbacks */
> +       notify_data->callback = NULL;
> +       notify_data->notify = NULL;
> +
>         complete_unregister_notify(notify_data);
>         return true;
>  }
> --
> 2.14.3

Applied.


-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux