On 10/22/2014 03:14 AM, Patrik Flykt wrote:
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.

I tried this suggestion, but it does not fix the problem I was trying to fix. rfkill_list is destroyed in __connman_technology_cleanup which happens long after plugins are cleaned up. This means most if not all technologies have already been destroyed (possibly without being properly released/removed) before we get to this point.

Based on your other reply though, it sounds like I need to fix my UI. I did not consider the case of a connman crash, which would be a good thing to handle. Also, there is the Released DBus signal that I was overlooking.

Here is the patch of what I did to implement your suggestion.

--- connman-1.26.orig/src/technology.c
+++ connman-1.26/src/technology.c
@@ -364,13 +364,6 @@ bool connman_technology_get_wifi_tetheri
     return true;
 }

-static void free_rfkill(gpointer data)
-{
-    struct connman_rfkill *rfkill = data;
-
-    g_free(rfkill);
-}
-
 static void technology_load(struct connman_technology *technology)
 {
     GKeyFile *keyfile;
@@ -1764,18 +1757,26 @@ int __connman_technology_remove_rfkill(u

     g_hash_table_remove(rfkill_list, GINT_TO_POINTER(index));

-    technology = technology_find(type);
-    if (!technology)
-        return -ENXIO;
+    return 0;
+}

-    technology_apply_rfkill_change(technology,
-        technology->softblocked, !technology->hardblocked, false);
+static void free_rfkill(gpointer data)
+{
+    struct connman_rfkill *rfkill = data;
+    struct connman_technology *technology;

-    technology_put(technology);
+    technology = technology_find(rfkill->type);
+    if (technology) {
+        technology_apply_rfkill_change(technology,
+            technology->softblocked, !technology->hardblocked, false);

-    return 0;
+        technology_put(technology);
+    }
+
+    g_free(rfkill);
 }

+
 int __connman_technology_init(void)
 {
     DBG("");

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

Reply via email to