Re: [PATCH BlueZ v4 1/6] pbap: Support calling pbap_init() after pbap_exit()

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

 



Hi Andrew,

On Mon, Apr 28, 2025 at 9:19 AM Andrew Sayers
<kernel.org@xxxxxxxxxxxxxxx> wrote:
>
> pbap_exit() didn't previously unregister itself thoroughly.  That
> was fine if it was only called when the service was about to exit,
> because everything was implicitly unregistered when the process ended.
> But we need to be more scrupulous if this can be called throughout
> the program's lifecycle.
>
> Send the UnregisterProfile message directly from pbap_exit(),
> then call unregister_profile().
>
> The UnregisterProfile message can't be sent directly from
> unregister_profile(), because that also needs to be called when
> register_profile() fails halfway through.
>
> Signed-off-by: Andrew Sayers <kernel.org@xxxxxxxxxxxxxxx>
> ---
>  obexd/client/pbap.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/obexd/client/pbap.c b/obexd/client/pbap.c
> index 2f234fadf..90f8bdc02 100644
> --- a/obexd/client/pbap.c
> +++ b/obexd/client/pbap.c
> @@ -1485,8 +1485,20 @@ void pbap_exit(void)
>  {
>         DBG("");
>
> -       dbus_connection_unref(conn);
> -       conn = NULL;
> +       g_dbus_remove_watch(system_conn, listener_id);
> +
> +       unregister_profile();
> +
> +       if (system_conn) {
> +               dbus_connection_close(system_conn);
> +               dbus_connection_unref(system_conn);
> +               system_conn = NULL;
> +       }
> +
> +       if (conn) {
> +               dbus_connection_unref(conn);
> +               conn = NULL;
> +       }
>
>         obc_driver_unregister(&pbap);
>  }
> --
> 2.49.0

Quite a few errors still: https://github.com/bluez/bluez/pull/1208

-- 
Luiz Augusto von Dentz





[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