Hi,

On Tue, 2014-10-21 at 12:27 -0500, David Lechner wrote:
> ---
>   src/connman.h    |  1 +
>   src/rfkill.c     |  2 ++
>   src/technology.c | 15 +++++++++++++++
>   3 files changed, 18 insertions(+)
> 
> diff --git a/src/connman.h b/src/connman.h
> index da01215..bab013b 100644
> --- a/src/connman.h
> +++ b/src/connman.h
> @@ -826,6 +826,7 @@ void __connman_service_save(struct connman_service 
> *service);
>    #include <connman/notifier.h>
>   +void __connman_technology_cleanup_rfkill(void);
>   int __connman_technology_init(void);
>   void __connman_technology_cleanup(void);
>   diff --git a/src/rfkill.c b/src/rfkill.c
> index 960cfea..2f073a9 100644
> --- a/src/rfkill.c
> +++ b/src/rfkill.c
> @@ -232,4 +232,6 @@ void __connman_rfkill_cleanup(void)
>       g_io_channel_unref(channel);
>       channel = NULL;
> +
> +     __connman_technology_cleanup_rfkill();
>   }
> diff --git a/src/technology.c b/src/technology.c
> index d80d9e6..5917c59 100644
> --- a/src/technology.c
> +++ b/src/technology.c
> @@ -1776,6 +1776,21 @@ int __connman_technology_remove_rfkill(unsigned 
> int index,
>       return 0;
>   }
>   +gboolean find_first(gpointer key, gpointer value, gpointer user_data)
> +{
> +     return TRUE;
> +}
> +
> +void __connman_technology_cleanup_rfkill(void)
> +{
> +     struct connman_rfkill *rfkill;
> +
> +     DBG("");
> +
> +     while (rfkill = g_hash_table_find(rfkill_list, find_first, NULL))
> +             __connman_technology_remove_rfkill(rfkill->index, rfkill->type);
> +}
> +
>   int __connman_technology_init(void)
>   {
>       DBG("");

This sort of works, but I'd like to fix the problem in src/technology.c,
where the problem manifests itself.

So it seems ConnMan is not doing the technology_put() cleanup in the
correct place. As you noticed this currently happens only in
__connman_technology_remove(), and not on shutdown where only
free_rfkill() is called. So the code starting with the line "technology
= technology_find(type);" in __connman_technology_remove() should
actually happen in free_rfkill() instead. That way no matter what frees
up an rfkill structure also causes a technology_put() where the last one
sends off a TechnologRemoved signal before destroying the technology
structure.

Cheers,

        Patrik


_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to