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

Eric Caruso ejcaruso at chromium.org
Wed Feb 21 00:04:18 UTC 2018


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));
     }
 }
 
-- 
2.16.1.291.g4437f3f132-goog



More information about the ModemManager-devel mailing list