[PATCH] mm-base-manager: remove element from hastable by key, not value

Aleksander Morgado aleksander at aleksander.es
Wed Feb 21 11:42:12 UTC 2018


On Wed, Feb 21, 2018 at 1:04 AM, Eric Caruso <ejcaruso at chromium.org> wrote:
> The hashtable is keyed on the UID of the MMDevice, and its hash
> function is g_str_hash. We shouldn't be passing a GObject into
> g_hash_table_remove because calling g_str_hash on an MMDevice is
> wrong.
> ---
>  src/mm-base-manager.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mm-base-manager.c b/src/mm-base-manager.c
> index 1673c25e..4b92ab0b 100644
> --- a/src/mm-base-manager.c
> +++ b/src/mm-base-manager.c
> @@ -628,7 +628,7 @@ remove_disable_ready (MMBaseModem *modem,
>      if (device) {
>          g_cancellable_cancel (mm_base_modem_peek_cancellable (modem));
>          mm_device_remove_modem (device);
> -        g_hash_table_remove (self->priv->devices, device);
> +        g_hash_table_remove (self->priv->devices, mm_device_get_uid (device));
>      }
>  }
>

Pushed to git master, thanks!

-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list